Skip to content

Instantly share code, notes, and snippets.

Rolf Erik Lekang relekang

Block or report user

Report or block relekang

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
@relekang
relekang / init-libdef.sh
Last active Aug 24, 2016
Init script for creating libdefs files for flowtype/flow-typed. Usage example `./init-libdef.sh lodash 4.x.x`
View init-libdef.sh
#!/bin/bash -eux
NAME=$1
VERSION=$2
FLOW_VERSION=0.25.x
echo $NAME@$VERSION
DIRECTORY=$(dirname $0)/definitions/npm/${NAME}_v$VERSION
@relekang
relekang / local_storage.js
Created Mar 15, 2016
API mock with local_storage
View local_storage.js
import _ from 'lodash'
export const get = (path, data) => {
const collection = JSON.parse(localStorage.getItem(path)) || []
if (data && data.id) {
return Promise.resolve(_.find(collection, ['id', data.id]))
}
return Promise.resolve(collection)
}
View example.js
export default React.createClass({
displayName: 'ExamplePage',
stores: [ExampleStore, OtherStore],
mixins: [StoreMixin],
render: function() {
return <h1>o/</h1>;
}
});
View eslint-pre-commit.sh
#!/bin/sh
CHANGED_JS_FILES=$(git diff --cached --name-only --diff-filter=ACMRTUXB -- '*.js')
echo
if [ -n "$CHANGED_JS_FILES" ]; then
eslint $CHANGED_JS_FILES
fi
View latex-in-atom.md

Writing latex with atom

Install language-latex and:

1. In init.coffee

path = require 'path'

atom.workspaceView.eachEditorView (editorView) ->
  editor = editorView.getEditor()
View 0-docker-dht-test-setup.md

Usage

curl https://gist.githubusercontent.com/relekang/6ba186afdb13297cdad4/raw/848b475ef725b6485dcd9bb137124bde1553f76c/setup.sh | sh
View python-thumbnails-roadmap.md

python-thumbnails

What is python-thumbnails

It is a python package for creating thumbnails. It is not tied to a specific web framework, but is designed to work with most of them and has planned integrations with Django and Flask.

Example site (Repo)
Documentation

Roadmap

@relekang
relekang / apm-test.sh
Created Feb 7, 2015
A test script for running `apm test` on a linux box
View apm-test.sh
#!/bin/sh
PID_PATH=/var/run/xvfb_99/`date +%s`.pid
start-stop-daemon --start --pidfile $PID_PATH --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1024x768x24 -ac +extension GLX +extension RANDR +render -noreset > /dev/null || exit 1
sleep 3 > /dev/null
export DISPLAY=:99 > /dev/null
apm test
EXIT_CODE=$?
start-stop-daemon --stop --pidfile $PID_PATH > /dev/null
exit $EXIT_CODE
@relekang
relekang / Makefile
Created Jan 13, 2015
Latex project makefile
View Makefile
ifeq ($(shell uname -s), Darwin)
OPEN='open'
else
OPEN='see'
endif
ifeq ($(USE_BIB), false)
COMPILE = pdflatex -halt-on-error report.tex >> logs/compile \
&& echo "Compiled report" || (cat logs/compile && fail)
else
View 20.gnuplot
set term png
set output '20.png'
set xlabel 'Windows'
set ylabel 'seconds'
plot '2-nodes','4-nodes','8-nodes'
set term postscript
set output '20.eps'
plot '2-nodes','4-nodes','8-nodes'
You can’t perform that action at this time.