Ruby: What does $1 mean?

According to Avdi Grimm from RubyTapas $1 is a global variable which can be used in later code: if “foobar” =~ /foo(.*)/ then puts “The matching word was #{$1}” end Output: “The matching word was bar” In short, $1, $2, $… are the global-variables used by some of the ruby library functions specially concerning REGEX … Read more

Backslashes in single quoted strings vs. double quoted strings

Double-quoted strings support the full range of escape sequences, as shown below: \a Bell/alert (0x07) \b Backspace (0x08) \e Escape (0x1b) \f Formford (0x0c) \n Newline (0x0a) \r Return (0x0d) \s Space (0x20) \t Tab (0x09) \v Vertical tab (0x0b) For single-quoted strings, two consecutive backslashes are replaced by a single backslash, and a backslash … Read more

The simplest possible reverse proxy [closed]

Found http://mitmproxy.org/ ! My use case is covered by: mitmproxy -p 8080 -P https://remote.site.example.com/ But there’s more. It also offers an ncurses UI for showing all requests done, and allows you to inspect them. This makes WireShark unnecessary. Install with your distro package installer or with easy_install as shown in the question: virtualenv mitmproxy; cd … Read more

How can I delete specific jobs from Resque queue without clearing the whole queue?

In resque’s sources (Job class) there’s such method, guess it’s what you need 🙂 # Removes a job from a queue. Expects a string queue name, a # string class name, and, optionally, args. # # Returns the number of jobs destroyed. # # If no args are provided, it will remove all jobs of … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)