Skip to content

Instantly share code, notes, and snippets.

View DanielVF's full-sized avatar

Daniel Von Fange DanielVF

View GitHub Profile
@DanielVF
DanielVF / lionback_template.php
Created January 19, 2010 13:52
PHP template engine for emailing form results.
// PHP template engine for emailing form results.
class LionbackTemplate{
function LionbackTemplate($template,$data){
$this->template=$template;
$this->data=$data;
}
function render(){
from suds.client import Client
URL = 'https://ws.customertest.newdea.com/NonprofitServices_100.asmx?wsdl'
LOGIN = ''
PASSWORD = ''
ORGXID = ''
client = Client(URL, timeout=600)
diff --git a/docco.coffee b/docco.coffee
index beb6ec7..399fe80 100644
--- a/docco.coffee
+++ b/docco.coffee
@@ -25,11 +25,11 @@
# and merging them into an HTML template.
generate_documentation: (source) ->
ensure_directory ->
- set_language source
code: fs.readFile source, (error, code) ->
var config = {
planet_font: 'bold 15px Arial,Helvetica ',
planet_pixels: [10,13,18,21,23,29],
display_size: 640,
display_margin: 50,
framerate: 5
}
// Setup Context
@DanielVF
DanielVF / game_simulator.py
Created March 1, 2011 15:04
Written to simulate games using the 'likelihood of superiority' bayesian elo results dump from the conclusion of the 2010 Google AI challenge. -- Daniel Von Fange
import random
"""
Written to simulate games using the 'likelihood of superiority'
bayesian elo results dump from the conclusion of the 2010 Google AI challenge.
-- Daniel Von Fange
"""
# We offset off this to find the scores
@DanielVF
DanielVF / gist:1074014
Created July 9, 2011 22:36
Solving the Teleprompter coding kata in clojure
; Solving the Teleprompter coding kata in clojure
; (http://codingkata.org/katas/unit/teleprompter)
(defn de-slang [text dictionary]
(->>
(.split text "\\$")
(map (fn [word] [(str "\\$" word "\\$") (get dictionary word)]))
(filter (fn [word_set] (last word_set)) )
(reduce (fn [str, word_set] (.replaceAll str (first word_set) (last word_set))) text)) )
@DanielVF
DanielVF / gist:1261888
Created October 4, 2011 15:06
Change all objects in an Amazon S3 bucket to public-read.
require 'rubygems'
require 'aws-sdk'
# Change this stuff.
AWS.config({
:access_key_id => 'YOURS_HERE',
:secret_access_key => 'YOURS_HERE',
})
bucket_name = 'YOUR_BUCKET_NAME'
@DanielVF
DanielVF / middleware.py
Created June 17, 2013 13:04
Ghetto Django page profiler
"""
Source, unknown.
Tweaked by Daniel Von Fange.
"""
import sys
import tempfile
import hotshot
import hotshot.stats
@DanielVF
DanielVF / gist:8370906
Created January 11, 2014 13:24
Collect all ebay prices on page, for pasting into excel/numbers.
$.makeArray($('div[itemprop=price]').map(function(){return $(this).text().replace(/[^0-9]/g,'');}) ).join("\n")
@DanielVF
DanielVF / debug.js
Created August 1, 2018 02:35
Origin helper for debugging events
// Example usage:
//
// console.table(await debugEvents(origin.contractService, {fromBlock:175, topics:[]}))
//
async function debugEvents(contractService, options){
const web3 = contractService.web3
// Lookup table for contracts from bytecode