This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// EDIT: SOLVED! | |
// The arguments are supposed to be | |
// [--no-pager log --all --source --abbrev-commit --grep=Story-Id: 12345] | |
// not | |
// [--no-pager log --all --source --abbrev-commit --grep='Story-Id: 12345'] | |
// because then it doesn't find the commits and then output is empty. | |
// The problem is that my function is returning empty stdout buffer | |
// even though the output is not empty when I run git from CLI. | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Authenticable | |
extend ActiveSupport::Concern | |
included do | |
key :username, String | |
key :email, String | |
key :crypted_password, String | |
key :password_salt, String | |
key :persistence_token, String | |
key :login_count, Integer, :default => 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'ostruct' | |
class OpenStruct | |
DEPTH = 5 | |
def self.deep(data, depth=0, &blck) | |
return data if depth > DEPTH | |
return data unless data.class == Hash | |
hash = {} | |
data.each do |key, value| | |
key = blck.call(key) if block_given? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'mechanize' | |
@username = 'user@domain.com' | |
@password = 'hi2u' | |
@download_path = File.expand_path 'downloads' | |
@wget_cookie = File.expand_path(File.dirname(__FILE__)) + '/wget-cookies.txt' | |
unless File.directory? @download_path | |
puts "@{download_path} doesn't exist!" | |
exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra' | |
require 'eventmachine' | |
get '/' do | |
stream(:keep_open) do |out| | |
count = 0 | |
timer = EM.add_periodic_timer(1) do | |
out << "<p>ohai</p>\n" | |
count += 1 | |
if count == 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script src='background.js'></script> | |
<style> | |
a#link { | |
color: #15c; | |
font-family: arial; | |
font-size: 13px; | |
} | |
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"log" | |
"net" | |
"net/http" | |
"net/rpc" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Lisp | |
Fs = { | |
:label => lambda {|name,value| Fs[name] = lambda { value } }, | |
:car => lambda {|sexp| sexp.first }, | |
:cdr => lambda {|sexp| sexp.slice(1, sexp.size) }, | |
:cons => lambda {|head,tail| [head] + tail }, | |
:atom => lambda {|sexp| !sexp.is_a?(Array) }, | |
:eq => lambda {|a,b| a == b }, | |
:if => lambda {|cnd,thn,els| cnd ? thn : els } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
VERSION_URL="https://appengine.google.com/api/updatecheck" | |
VERSION=$(echo $(curl ${VERSION_URL}) | sed -E 's/release: \"(.+)\"(.*)/\1/g') | |
ARCH="386" | |
if [[ `uname -a` == *x86_64* ]] | |
then | |
ARCH="amd64" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def login(username, password) | |
page.visit("http://#{username}:#{password}@#{page.driver.rack_server.host}:#{page.driver.rack_server.port}/") | |
end |
OlderNewer