Skip to content

Instantly share code, notes, and snippets.

Greg Leuch gleuch

Block or report user

Report or block gleuch

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View wallet.js
const EthereumTx = require('ethereumjs-tx');
const _ = require('lodash');
class Wallet {
constructor(web3, address, privateKey) {
this.web3 = web3;
this.address = address;
this.privateKey = Buffer.from(privateKey, 'hex');
}
@mperham
mperham / convert.rake
Created Mar 15, 2012
Ruby script to update MySQL from Latin1 to UTF8 without data conversion
View convert.rake
desc "convert a latin1 database with utf8 data into proper utf8"
task :convert_to_utf8 => :environment do
puts Time.now
dryrun = ENV['DOIT'] != '1'
conn = ActiveRecord::Base.connection
if dryrun
def conn.run_sql(sql)
puts(sql)
end
else
@iwinux
iwinux / gist:1529093
Created Dec 28, 2011
config.assets.precompile
View gist:1529093
def compile_asset?(path)
# ignores any filename that begins with '_' (e.g. sass partials)
# all other css/js/sass/image files are processed
if File.basename(path) =~ /^[^_].*\.\w+$/
puts "Compiling: #{path}"
true
else
puts "Ignoring: #{path}"
false
end
@Epictetus
Epictetus / gist:1031117
Created Jun 17, 2011 — forked from WizardOfOgz/gist:1012107
Save Base64-encoded images with Paperclip
View gist:1031117
class Avatar < ActiveRecord::Base
attr_accessor :content_type, :original_filename, :image_data
before_save :decode_base64_image
has_attached_file :image,
PAPERCLIP_CONFIG.merge(
:styles => {
:thumb => '32x32#',
:medium => '64x64#',
View inline_gist.js
/*-------- Here's how your Gists render in #newtwitter's details pane --------*/
twttr.mediaType('twttr.media.types.Gist')
.url('http://gist.github.com')
.matcher(/\b(?:https?\:\/\/)?gist\.github\.com\/(\S+)/g)
.icon('generic')
You can’t perform that action at this time.