Skip to content

Instantly share code, notes, and snippets.

@Wizek
Wizek / ManualKey.hs
Created May 2, 2017 23:58 — forked from carymrobbins/ManualKey.hs
Yesod - manually creating a Key
-- Good
import Database.Persist.Sql
toSqlKey 1 :: UserId
-- Bad
Prelude.read "UserKey {unUserKey = SqlBackendKey {unSqlBackendKey = 1}}" :: UserId
@Wizek
Wizek / gist:a23d3ee6b79e57dfb17f8e5b5a88f43b
Last active December 15, 2016 17:19 — forked from jturcotte/gist:3912465
Terminator plugin to open paths in Sublime Text
import re
import terminatorlib.plugin as plugin
import subprocess
# Every plugin you want Terminator to load *must* be listed in 'AVAILABLE'
AVAILABLE = ['FileURLHandler']
class FileURLHandler(plugin.URLHandler):
capabilities = ['url_handler']
handler_name = 'file_path'
@Wizek
Wizek / Code.gs
Created August 23, 2016 21:17 — forked from karfau/Code.gs
Google App Script to merge all documents from a GDrive Folder into a single GDocs document using an intermediate GSpreadsheet
var C_TYPE = 'Type',
C_TITLE = 'Title',
C_ID = 'ID',
C_URL = 'URL',
C_MIME_TYPE = 'file type',
C_ELEMENTS = 'elements in document';
var HEADERS = [C_TYPE, C_TITLE, C_ID, C_URL, C_MIME_TYPE, C_ELEMENTS];
function onOpen(){
@Wizek
Wizek / gist:e5a7ebbdaa546a5e260cdcc112f6f06a
Created July 23, 2016 09:03 — forked from simonmichael/gist:1185421
ghc-pkg-clean, ghc-pkg-reset
# unregister broken GHC packages. Run this a few times to resolve dependency rot in installed packages.
# ghc-pkg-clean -f cabal/dev/packages*.conf also works.
function ghc-pkg-clean() {
for p in `ghc-pkg check $* 2>&1 | grep problems | awk '{print $6}' | sed -e 's/:$//'`
do
echo unregistering $p; ghc-pkg $* unregister $p
done
}
# remove all installed GHC/cabal packages, leaving ~/.cabal binaries and docs in place.
@Wizek
Wizek / firebase_copy.js
Last active August 2, 2016 21:42 — forked from katowulf/firebase_copy.js
Move or copy a Firebase path to a new location
function copyFbRecord(oldRef, newRef) {
oldRef.once('value', function(snap) {
newRef.set( snap.value(), function(error) {
if( error && typeof(console) !== 'undefined' && console.error ) { console.error(error); }
});
});
}
@Wizek
Wizek / deptree.py
Last active August 29, 2015 14:26 — forked from aszlig/deptree.py
Generate GraphViz dependency tree of a TaskWarrior task.
#!/usr/bin/env python
import sys
from subprocess import Popen, PIPE
from json import loads
class Task(object):
def __init__(self, data):
self.data = data
git show HEAD --stat=200 | tail +7 | awk '{ print $3 " "$4 " " $1}' | sort -n -r | less
MainCtrl = ($scope) ->
$scope.list = [4,2,1,11]
$scope.set = {a:1,b:1,c:1}
$scope.fn = (x) -> console.log(x);x
"require github://Wizek/jquery/src/intro.js"
"require github://Wizek/jquery/src/core.js"
"require github://Wizek/jquery/src/callbacks.js"
"require github://Wizek/jquery/src/deferred.js"
"require github://Wizek/jquery/src/support.js"
"require github://Wizek/jquery/src/data.js"
"require github://Wizek/jquery/src/queue.js"
"require github://Wizek/jquery/src/attributes.js"
"require github://Wizek/jquery/src/event.js"
@Wizek
Wizek / logFactory.js
Created September 18, 2013 12:48 — forked from Wizek/logFactory.js
// Superpowered logging for AngularJS.
angular.module('logFactory', ['ng'])
.value('logFactory_whiteList', /.*/)
//.value('logFactory_whiteList', /!|.*Ctrl|run/)
.value('logFactory_piercingMethods', {warn:true, error:true})
.factory('logFactory', ['$log', 'logFactory_whiteList' , 'logFactory_piercingMethods', function ($log, whiteList, piercing) {
piercing = piercing || {}