Skip to content

Instantly share code, notes, and snippets.

spiffytech spiffytech

Block or report user

Report or block spiffytech

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
@spiffytech
spiffytech / index.js
Last active Oct 1, 2015
requirebin sketch
View index.js
var beautify = require('js-beautify').js_beautify;
var pretty = require("js-object-pretty-print").pretty;
function show(el, val) {
document.getElementById(el).innerHTML = pretty(val, 4, "HTML");
}
// Declare our initial value
var original = {
a: 1,
@spiffytech
spiffytech / websharper.patch
Last active Aug 29, 2015
Patches an F# Scaffold project with basic WebSharper support
View websharper.patch
diff --git a/Web.config b/Web.config
new file mode 100644
index 0000000..053354f
--- /dev/null
+++ b/Web.config
@@ -0,0 +1,358 @@
+<configuration>
+ <configSections>
+ <sectionGroup name="elmah">
+ <!-- NOTE! If you are using ASP.NET 1.x then remove the
@spiffytech
spiffytech / import.rb
Last active Feb 5, 2019 — forked from evanwalsh/import.rb
Imports a Squarespace dump into Jekyll
View import.rb
# coding: utf-8
require 'rubygems'
require 'hpricot'
require 'nokogiri'
require 'fileutils'
require 'safe_yaml'
require 'time'
require 'uri'
require 'open-uri'
View keybase.md

Keybase proof

I hereby claim:

  • I am spiffytech on github.
  • I am spiffytech (https://keybase.io/spiffytech) on keybase.
  • I have a public key whose fingerprint is 0528 73D9 49FE B3AC 3734 C80A 5243 7EC7 D25A CEB9

To claim this, I am signing this object:

@spiffytech
spiffytech / attr_replace.py
Last active Aug 29, 2015
Replaces nested attributes on namedtuples
View attr_replace.py
def attr_update(obj, child=None, _call=True, **kwargs):
'''Updates attributes on nested namedtuples.
Accepts a namedtuple object, a string denoting the nested namedtuple to update,
and keyword parameters for the new values to assign to its attributes.
You may set _call=False if you wish to assign a callable to a target attribute.
Example: to replace obj.x.y.z, do attr_update(obj, "x.y", z=new_value).
Example: attr_update(obj, "x.y.z", prop1=lambda prop1: prop1*2, prop2='new prop2')
Example: attr_update(obj, "x.y", lambda z: z._replace(prop1=prop1*2, prop2='new prop2'))
You can’t perform that action at this time.