Skip to content

Instantly share code, notes, and snippets.

@jimtla
jimtla / underscoreR.coffee
Created May 6, 2012 21:51
Add CoffeeScript friendly argument order to Underscore.js
# Five lines of code that will make your underscore + CoffeeScript use cleaner.
# Creates an underscore function for each function in to_reverse with R (short for Reversed) appended to the name.
# The R version moves the function argument (first argument in normal underscore) to the end,
# so you can write:
$(window).scroll _.throttleR 500, ->
console.log "This print's at most every 500ms"
# Instead of:
$(window).scroll _.throttle ->
console.log "This prints at most every 500ms too"
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 1, 2024 03:34
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@vojtajina
vojtajina / all-templates.html
Created August 15, 2012 00:00
AngularJS: load all templates in one file
<script type="text/ng-template" id="one.html">
<div>This is first template</div>
</script>
<script type="text/ng-template" id="two.html">
<div>This is second template</div>
</script>
@jpetazzo
jpetazzo / README.md
Last active September 30, 2022 05:36
Share a directory with a docker container

Rectifier

The diode bridge is the simplest rectifier I know.

Rectifier lets you share a directory with a docker container (just like $yourvm shared folders).

You don't have to install anything in your containers, and you only need to install diod in the host. diod is packaged on Ubuntu/Debian distros, and will automatically be apt-get install-ed if needed.

Since it uses diod to make a bridge, I called it rectifier. Yeah, that sucks, so if you have a better name, I'll steal it!

@pthariensflame
pthariensflame / IndexedPrivilege.md
Last active November 7, 2019 10:58
An introduction to the indexed privilege monad in Haskell, Scala and C#.

The Indexed Privilege Monad in Haskell, Scala, and C#

We've already looked at two different indexed monads in our tour so far, so let's go for a third whose regular counterpart isn't as well known: the privilege monad.

Motivation

The regular privilege monad allows you to express constraints on which operations a given component is allowed to perform. This lets the developers of seperate interacting components be statically assured that other components can't access their private state, and it gives you a compile-time guarantee that any code that doesn't have appropriate permissions cannot do things that would require those permissions. Unfortunately, you cannot easily, and sometimes cannot at all, build code in the privilege monad that gains or loses permissions as the code runs; in other words, you cannot (in general) raise or lower your own privilege level, not even when it really should be a

@henrik-muehe
henrik-muehe / Dockerfile
Created August 5, 2013 11:47
Allows installing the ubuntu "fuse" package without creating any devices. Used to install packages on docker which require fuse but do not actively use it.
...
# Fake a fuse install
RUN apt-get install libfuse2
RUN cd /tmp ; apt-get download fuse
RUN cd /tmp ; dpkg-deb -x fuse_* .
RUN cd /tmp ; dpkg-deb -e fuse_*
RUN cd /tmp ; rm fuse_*.deb
RUN cd /tmp ; echo -en '#!/bin/bash\nexit 0\n' > DEBIAN/postinst
RUN cd /tmp ; dpkg-deb -b . /fuse.deb
@widged
widged / d3lib.md
Created October 4, 2013 03:29
d3 libraries

chartFactory

/affini-tech/ChartFactory

Based on D3.JS and Dimple, ChartFactory provide the ability to build quickly D3.JS charts without coding any lines of javascript. Just define your dashboard in a JSON and voila !

charts: [
        {id:'chart1',
         width:800,height:250,

xAxis:{type:'Category',field: "Month",orderRule:'Date'},

@Fuuzetsu
Fuuzetsu / hackagedocs
Last active December 13, 2022 22:40
Script for generating and uploading missing documentation for your Hackage packages. Now with fixed package links and contents page.
#!/usr/bin/env bash
cabal configure && cabal build && cabal haddock --hyperlink-source \
--html-location='/package/$pkg-$version/docs' \
--contents-location='/package/$pkg'
S=$?
if [ "${S}" -eq "0" ]; then
cd "dist/doc/html"
DDIR="${1}-${2}-docs"
cp -r "${1}" "${DDIR}" && tar -c -v -z --format=ustar -f "${DDIR}.tar.gz" "${DDIR}"
CS=$?
@rehno-lindeque
rehno-lindeque / .ghci
Last active August 29, 2015 13:59
Useful REPL utils for Yesod (as well as some generally useful functions!)
:set -i.:config:dist/build/autogen
:set -XCPP -XTemplateHaskell -XQuasiQuotes -XTypeFamilies -XFlexibleContexts -XGADTs -XOverloadedStrings -XMultiParamTypeClasses -XGeneralizedNewtypeDeriving -XEmptyDataDecls -XDeriveDataTypeable
import Prelude
import Control.Applicative
import Data.Char
import Data.List
import qualified Data.Text as T
import Data.Text (Text)
@timrwood
timrwood / moment-immutable.js
Created September 16, 2014 17:16
Immutable Moments
(function (root, factory) {
"use strict";
if (typeof define === 'function' && define.amd) {
define(['moment'], factory);
} else if (typeof exports === 'object') {
module.exports = factory(require('moment'));
} else {
factory(root.moment);
}
}(this, function (moment) {