Skip to content

Instantly share code, notes, and snippets.

View branneman's full-sized avatar

Bran van der Meer branneman

View GitHub Profile
.whatever {
-webkit-box-shadow: 0 2px 2px rgba(0,0,0,0.5) inset;
-moz-box-shadow: 0 2px 2px rgba(0,0,0,0.5) inset;
-o-box-shadow: 0 2px 2px rgba(0,0,0,0.5) inset;
box-shadow: 0 2px 2px rgba(0,0,0,0.5) inset;
}
@krijnhoetmer
krijnhoetmer / gist:1109243
Created July 27, 2011 12:21
CSS 'build' thingy
<?php
$src = 'foo { border-radius: 4px; }
bar { box-shadow: 5px 0 0 rgba(0, 0, 0, .5);
baz { background-image: url(img/baz.png); }
quux { background-image: url(img/quuz.png#!); }';
preg_match_all('/url\((.*\.png)\)/U', $src, $matches);
foreach ($matches[1] as $match) {
$src = str_replace($match, 'data:image/png;base64,' . base64_encode(file_get_contents($match)), $src);
@DrBoolean
DrBoolean / pointfree folktale.js
Last active April 14, 2016 14:14
Pointfree fantasy working with folktale's either
require("pointfree-fantasy").expose(global);
var curry = require("lodash.curry");
var fs = require("fs");
var Either = require("data.either");
// HELPERS
// ============
var add = curry(function(x,y) { return x + y });
@guileen
guileen / async.js
Created March 11, 2012 15:59
parallel javascript
// This is an lite version of `async`, see https://github.com/caolan/async
//
// es5shim.js is required for old version browsers
//
// Author: Gui Lin
// Email: guileen@gmail.com
var async = {};
@peeke
peeke / DataStore.js
Last active October 21, 2016 08:17
A single data store for modules to communicate with.
/**
* A single data store for modules to communicate with. Keeping 'the truth' in a single place reduces bugs and allows
* for greater seperation of concerns.
*
* The module can be used as a singleton through DataStore.getSingleton('key'), or on instance basis through the new keyword.
*
* Uses the Observer module found here: https://gist.github.com/peeke/42a3f30c2a3856c65c224cc8a47b95f9
*
* @name DataStore
* @author Peeke Kuepers
param (
[string]$instances = 10
)
docker rm -f selenium-hub
docker run --restart=always -d -p 4444:4444 --name selenium-hub selenium/hub:3.0.0-dubnium
$i=0
while($i -ne $instances)
{
@boschni
boschni / commit-msg
Last active January 11, 2017 10:29
Git commit hook to automatically add branch name to every commit message. Put in ".git/hooks/commit-msg" and give the file execute rights.
#!/bin/sh
#
# Automatically adds branch name to every commit message.
#
NAME=$(git branch | grep '*' | sed 's/* //')
if [ -n "$NAME" ]
then
if [ "$NAME" = "master" ]
then
echo $(cat "$1") > "$1"
@peeke
peeke / ArrayLikeObservable.es6
Last active May 30, 2017 21:25
Array function based Steam & EventStream implementation. Also handles promises.
class Observable {
constructor(fn) {
this._fn = fn;
this._children = [];
const handler = {
get(target, prop) {
return prop in target || !(prop in Array.prototype)
@peeke
peeke / observer.js
Last active September 21, 2017 07:43
Used for inter-object communication. (Semi-)drop in replacement for Rik Schennink's Observer.
/**
* Used for inter-object communication.
* (Semi-)drop in replacement for Rik Schennink's Observer.
*
* Implementation differences:
* - ES6
* - The use of WeakMaps
* - inform() and conceal() don't return a boolean indicating success.
* - Subscription fn's are called with seperate arguments, instead of one data parameter. This is backwards compatible.
*
@peeke
peeke / box.es6
Created May 22, 2017 07:32
The box pattern
// The box pattern:
// Array chaining methods for single values
const box = v => [ v ]
box(1)
.map(n => n * 2)
.map(n => n + 2)
.pop()