Skip to content

Instantly share code, notes, and snippets.

@tomconte
tomconte / truffle-config.js
Last active July 14, 2019 03:38
Example Truffle 3.0 configuration file to allow deploying contracts to an Azure "Bletchley" Ethereum consortium network. Based on the Truffle docs for Infura (http://truffleframework.com/tutorials/using-infura-custom-provider).
var bip39 = require("bip39");
var ethwallet = require('ethereumjs-wallet');
var ProviderEngine = require("web3-provider-engine");
var WalletSubprovider = require('web3-provider-engine/subproviders/wallet.js');
var Web3Subprovider = require("web3-provider-engine/subproviders/web3.js");
var Web3 = require("web3");
// Insert raw hex private key here, e.g. using MyEtherWallet
var wallet = ethwallet.fromPrivateKey(Buffer.from('abcdef', 'hex'));
@esemwy
esemwy / mkdim.py
Created June 10, 2015 12:13
Create DAZ Install Manager packages from zip or directory
#!/usr/bin/python
import uuid
import os
from zipfile import ZipFile, is_zipfile
import sys
import time
from random import randint
import argparse
import re
@drupalista-br
drupalista-br / gist:4223201
Created December 6, 2012 09:23
Drupal 7 Profile2 Custom User Tab Form ( MYMODULE_profile2_MYPROFILE2TYPE.inc )
<?php
/**
* @file
* User Profile2 MYPROFILE2TYPE.
*/
/**
* Page callback for user profile2 MYPROFILE2TYPE form.
*/
function MYMODULE_load_profile2_MYPROFILE2TYPE_form($form, &$form_state, $user = NULL) {
@ZJONSSON
ZJONSSON / index.html
Created June 20, 2012 01:21
D3 + Leaflet (fork mbostock)
<!DOCTYPE html>
<title>D3 + Leaflet (fork from bost.ocks.org/mike/leaflet/)</title>
<style>
#map { width: 960px; height: 500px;}
path { fill: #000; fill-opacity: .2; stroke: #fff; stroke-width: 1.5px;}
path:hover { fill: brown;fill-opacity: .7;}
</style>
<p id="map"><p>
<script src="http://d3js.org/d3.v2.min.js?2.9.3"></script>
<script src="leaflet.js"></script>
@GothAck
GothAck / index.js
Created March 20, 2012 18:33
Parsing BIG compressed XML data (OpenStreetMap) with Node.js
#!/usr/bin/env node
/*
* Parsing BIG compressed data with Node.js and SAX
* Probably some bugs, but worked fine for OpenStreetMap Great Britain bz2
* Greg Miell 2012
*/
// Simple string trim prototype extension
String.prototype.trim = function() {
@codemasta92
codemasta92 / gist:1555328
Created January 3, 2012 15:24
Button class with EaselJS
(function(k) {
var Button = function(a, x, y) {
this.initialize(a,x,y)
},p = Button.prototype = new DisplayObject;
p.left = 0;
p.top = 0;
p.ypos = 0;
p.image = null;
p.snapToPixel = true;
@tecoholic
tecoholic / osm2geo.js
Created November 27, 2011 04:57
OSM2GEO - A JS Converter to convert OSM to GeoJSON
/**************************************************************************
* OSM2GEO - OSM to GeoJSON converter
* OSM to GeoJSON converter takes in a .osm XML file as input and produces
* corresponding GeoJSON object.
*
* AUTHOR: P.Arunmozhi <aruntheguy@gmail.com>
* DATE : 26 / Nov / 2011
* LICENSE : WTFPL - Do What The Fuck You Want To Public License
* LICENSE URL: http://sam.zoy.org/wtfpl/
*
@jacine
jacine / field.tpl.php
Created August 31, 2011 18:33
My default hook_preprocess_field() and field.tpl.php
<?php
/**
* Implements template_preprocess_field().
*/
function THEME_preprocess_field(&$vars) {
// If the view mode is "full" use <h2> for the field labels. Otherwise,
// assume a teaser or more compact view mode is being displayed, and use <h3>.
$vars['heading'] = ($vars['element']['#view_mode'] == 'full') ? 'h2' : 'h3';
@albertsun
albertsun / gist:674563
Created November 12, 2010 19:44
Parse GeoJSON for Raphael
var allPolygons = [];
function setPolys(geom) {
/* geom: a GeoJSON object.
Parse geom, and add it as a child to the global Raphael object, R.
*/
//geom.type either Polygon or MultiPolygon
var translationFunction = function(coords) {
var projected = Projections.contiguous.forward(coords);
var x = 217+(projected[0]*190/2400000);