Skip to content

Instantly share code, notes, and snippets.

View Sija's full-sized avatar

Sijawusz Pur Rahnama Sija

View GitHub Profile
@obscuren
obscuren / poc-post.md
Last active August 29, 2015 14:06
Ethereum Proof Of Concept Screenshots

I just came across some old screenshots of the Ethereal / Mist browser. It's funny to see how interfaces change over time

PoC 0 (Pre Proof of Concept)

PoC 0

PoC 1

PoC 1

require 'syslog'
def log(message)
# $0 is the current script name
Syslog.open($0, Syslog::LOG_PID | Syslog::LOG_CONS) { |s| s.warning message }
end
@nall
nall / KBCollectionExtensions.h
Created October 18, 2009 05:31
Kicking Bear Collection Extensions
//
// KBCollectionExtensions.h
//
// Created by Guy English on 25/02/08.
// Copyright 2008 Kickingbear. All rights reserved.
//
#import <Cocoa/Cocoa.h>
/*
require File.dirname(__FILE__) + '/spec_helper'
describe "The library itself" do
Spec::Matchers.define :have_no_tab_characters do
match do |filename|
@failing_lines = []
File.readlines(filename).each_with_index do |line,number|
@failing_lines << number + 1 if line =~ /\t/
end
@failing_lines.empty?
// Puncture a closure, absolute madness
Function.prototype.puncture = function(){
var wormhole = function(__cmd__){
return eval(__cmd__);
};
var source = ('' + this).match(/function.+?\{([\s\S]*)\}/)[1];
var fn = new Function('this.wormhole=' + wormhole + '\n' + source);
gem 'cramp'
gem 'erubis', '2.6.5'
gem 'usher', "0.6.0"
@shinzui
shinzui / connection_fix.rb
Created February 24, 2010 02:26 — forked from defunkt/connection_fix.rb
MySQL has gone away fix
# If your workers are inactive for a long period of time, they'll lose
# their MySQL connection.
#
# This hack ensures we re-connect whenever a connection is
# lost. Because, really. why not?
#
# Stick this in RAILS_ROOT/config/initializers/connection_fix.rb (or somewhere similar)
#
# From:
# http://coderrr.wordpress.com/2009/01/08/activerecord-threading-issues-and-resolutions/
@avsej
avsej / paperclip_attachments_to_json.rb
Created September 17, 2010 08:35
dump paperclip attachment urls to json
module PaperclipAttachmentsToJSON
module ClassMethods
def has_attached_file_with_explicit_urls(name, options = {})
has_attached_file_without_explicit_urls(name, options)
# explicit url method definition
url_method = <<-EOM
def %{name}_%{style}_url # def avatar_original_url
%{name}.url(:%{style}) # avatar.url(:original)
end # end
@dctrwatson
dctrwatson / gist:948644
Created April 29, 2011 17:14
MySQL HAProxy replication check using mk-heartbeat
We couldn’t find that file to show.
@geoffgarside
geoffgarside / ip_address_validator.rb
Created November 4, 2011 14:55
Rails 3.x IP Address validator class
# The IP Address Validator accepts the following options
#
# * allow_nil - allows nil values
# * allow_blank - allows blank values
# * allow_cidr - allows /prefixlen CIDR masks in values
#
# the validator will use regular expressions in an attempt to prevent
# malformed IP addresses from being passed to the IPAddr.new initializer
# as this method can be very slow to raise exceptions for malformed input.
class IpAddressValidator < ActiveModel::EachValidator