Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View buren's full-sized avatar

Jacob Burenstam Linder buren

View GitHub Profile
@buren
buren / keybase.md
Created August 26, 2015 09:24
Keybase verification

Keybase proof

I hereby claim:

  • I am buren on github.
  • I am buren (https://keybase.io/buren) on keybase.
  • I have a public key whose fingerprint is 323D 61B6 0AC7 6D5D AAE3 9F9B 1C12 24B1 298D BF94

To claim this, I am signing this object:

@buren
buren / zsh-git-prompt
Last active August 29, 2015 13:55
zsh-git-prompt
# Shameless steal from http://askubuntu.com/a/85111
# git branch in zsh-prompt
echo '
autoload -Uz vcs_info
precmd () { vcs_info }
setopt prompt_subst
PS1="\$vcs_info_msg_0_$PS1"' >> ~/.zshrc
@buren
buren / RetryableCall.rb
Created April 16, 2014 09:21
Retry given block until response is not nil or max_retries is reached
class RetryableCall
DEFAULT_OPTIONS = {
sleep: 0.5,
max_retries: 5
}
def self.perform options = {}, &block
new(options).perform(&block)
end

Keybase proof

I hereby claim:

  • I am buren on github.
  • I am buren (https://keybase.io/buren) on keybase.
  • I have a public key whose fingerprint is EBA4 FF7D C0DF C205 02B8 9A24 C85F B75E 410E 4CC4

To claim this, I am signing this object:

@buren
buren / Singelton.java
Created May 7, 2014 19:26
Simple Java Singelton Example
package utils;
import java.net.URL;
public class Enduro {
private static Enduro ourInstance = new Enduro();
public static Enduro getInstance() {
return ourInstance;
}
@buren
buren / gem_console.rb
Created October 5, 2014 08:29
Put this in the Gem's Rakefile.
# https://gist.github.com/buren-trialbee/f51c6d37ea96618bcc49
task :console do
require 'irb'
require 'irb/completion'
require 'my_gem'
ARGV.clear
IRB.start
end
@buren
buren / meta_ruby.rb
Created October 22, 2014 10:11
Simple Ruby meta programming example
class Meta
def self.make_method(meth_name)
define_method meth_name do |adjective|
puts "#{meth_name} is a #{adjective} method name"
end
end
def method_missing(meth, *args, &block)
puts "Method #{meth} is not defined on this class"
self.class.make_method(meth)
@buren
buren / send_hipchat_message.bash
Created January 26, 2015 18:29
Send message to private HipChat room using cURL
ROOM_ID=yourroomname
OWNER_ID=XXXYYYX
AUTH_TOKEN=XXXYYYXXX
MESSAGE="Hello world!"
curl --header "content-type: application/json" --header "Authorization: Bearer $AUTH_TOKEN" -X POST \
-d "{\"name\":\"dev\",\"privacy\":\"private\",\"is_archived\":false,\"is_guest_accessible\":false,\"topic\":\"cURL\",\"message\":\"Message sent to HipChat from cURL\",\"color\":\"green\",\"owner\":{\"id\":$OWNER_ID}}" https://api.hipchat.com/v2/room/$ROOM_ID/notification
function countCSSRules() {
var results = '',
log = '';
if (!document.styleSheets) {
return;
}
for (var i = 0; i < document.styleSheets.length; i++) {
countSheet(document.styleSheets[i]);
}
function countSheet(sheet) {
@buren
buren / permute_name.rb
Created May 24, 2015 11:59
Permute name
require 'set'
last = (ARGV.shift || fail('<int> Permute of last n chars must be set')).to_i
seed = ARGV
fail 'At least one seed must be provided' if seed.empty?
def say(name)
puts name
`say #{name}`