Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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: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 / 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 / somesquares.hs
Created August 15, 2017 14:52 — forked from ali-abrar/somesquares.hs
Simple Canvas Example
{-# LANGUAGE ScopedTypeVariables #-}
import Reflex.Dom
import GHCJS.DOM.CanvasRenderingContext2D (putImageData, setFillStyle, fillRect)
import GHCJS.DOM.HTMLCanvasElement (getContext)
import GHCJS.DOM.ImageData (newImageData')
import Control.Monad.IO.Class (liftIO)
import GHCJS.DOM.Types (CanvasStyle(..), CanvasRenderingContext2D(..), toJSString, castToHTMLCanvasElement)
import GHCJS.Marshal (toJSVal)
import Data.Time (getCurrentTime)
@Wizek
Wizek / a.txt
Created August 19, 2017 10:56 — forked from lspitzner/a.txt
sublime3+ghcid setup for quick haskell coding feedback
sublime3 and ghcid setup for quick haskell coding feedback
tested on sublime 3
(you can omit the SublimeOnSaveBuild steps, as the result is not
completely reliable anyways. i still find it useful, though.)
steps:
- install https://github.com/lspitzner/SublimeOnSaveBuild
(original from alexnj; in his/her version the build-window gets closed
@Wizek
Wizek / .ghci
Created August 19, 2017 16:46 — forked from 3noch/.ghci
Reflex-DOM Auto Reload Development with ghcid
:set prompt "> "
:set -isrc
:load Main
@Wizek
Wizek / Run.hs
Created August 19, 2017 16:48 — forked from dalaing/Run.hs
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE OverloadedStrings #-}
module Run (
runner
) where
import Control.Monad.Reader (ReaderT, runReaderT)
import Data.Foldable (traverse_)
@Wizek
Wizek / backblaze b2 backup script
Created August 29, 2017 23:10 — forked from scottlinux/backblaze b2 backup script
Backup script for backblaze b2
#!/usr/bin/env bash
#
# Backup selected directories to a Backblaze B2 bucket
#
# Example daily cron:
# @daily /usr/local/bin/b2backup >/dev/null
#
# Account creds
id=xxxxxxxxxx