Skip to content

Instantly share code, notes, and snippets.

View gleuch's full-sized avatar
🏃‍♂️
Marathon

Greg Leuch gleuch

🏃‍♂️
Marathon
View GitHub Profile
/*-------- 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')
@Epictetus
Epictetus / gist:1031117
Created June 17, 2011 09:24 — forked from WizardOfOgz/gist:1012107
Save Base64-encoded images with Paperclip
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#',
@iwinux
iwinux / gist:1529093
Created December 28, 2011 18:38
config.assets.precompile
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
@mperham
mperham / convert.rake
Created March 15, 2012 17:44
Ruby script to update MySQL from Latin1 to UTF8 without data conversion
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
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');
}
@simov
simov / README.md
Last active March 28, 2024 03:26
Run `node` scripts using `nvm` and `crontab` without hardcoding the node version

Run node scripts using nvm and crontab without hardcoding the node version

cronjob.env.sh

#!/bin/bash

# NVM needs the ability to modify your current shell session's env vars,
# which is why it's a sourced function
@antony
antony / bash.sh
Last active February 8, 2022 01:36
Auth0 SSR Compatible Integration with Sapper
npm install --save express express-openid-connect
@botdad
botdad / CREATE07Proxy.sol
Created December 22, 2021 19:14
Proof of concept for rewritable data contracts
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.11;
import "./utils/Bytecode.sol";
contract CREATE07Proxy {
error ErrorDestroyingContract();
error ErrorDeployingToDeterministicAddress();
function deployDataContract(bytes memory data) external {