Skip to content

Instantly share code, notes, and snippets.

// 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.
//
@kdwinter
kdwinter / authenticable.rb
Last active September 5, 2015 05:45
Authlogic plugin for MongoMapper
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
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?
@jmazzi
jmazzi / peepcode.rb
Created May 24, 2011 13:54
A script to download all Peepcode screencasts with ruby & wget (supports resume)
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
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
@beccasaurus
beccasaurus / background.html
Last active December 16, 2015 04:19
Copy Rally Link
<html>
<head>
<script src='background.js'></script>
<style>
a#link {
color: #15c;
font-family: arial;
font-size: 13px;
}
</style>
@oscardelben
oscardelben / server.go
Created May 1, 2013 01:27
The coupons RPC server
package main
import (
"fmt"
"log"
"net"
"net/http"
"net/rpc"
)
@p8
p8 / lithp.rb
Created January 26, 2012 00:34 — forked from fogus/lithp.rb
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 }
}
@stephanos
stephanos / install-app-engine-sdk
Last active January 15, 2017 08:33
Download current Go App Engine SDK
#!/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
@alishutc
alishutc / login_helper.rb
Created March 15, 2012 12:59
Login in using HTTP basic authentication with Capybara selenium driver
def login(username, password)
page.visit("http://#{username}:#{password}@#{page.driver.rack_server.host}:#{page.driver.rack_server.port}/")
end