Skip to content

Instantly share code, notes, and snippets.

I may be slow to respond.

Tommy tleunen

I may be slow to respond.
View GitHub Profile
tleunen / webtask-openexchangerate.js
Last active May 30, 2018
View webtask-openexchangerate.js
const request = require('request');
const OE_LATEST = `${OPEN_EXCHANGE_API_URL}/latest.json`;
module.exports = function(ctx, done) {
const APP_ID =;
const url = `${OE_LATEST}?app_id=${APP_ID}`;
tleunen / create-reducer.js
Last active Mar 16, 2018
Easy create a redux reducer
View create-reducer.js
export default function createReducer(initialState, handlers) {
return function reducer(state = initialState, action) {
let nextState = state;
if ({}, '*')) {
nextState = handlers['*'](nextState, action);
if ({}, action.type)) {
return handlers[action.type](nextState, action);
tleunen / google_closure_compiler_args.txt
Created Aug 27, 2014
Help for the arguments available for Google Closure Compiler
View google_closure_compiler_args.txt
--accept_const_keyword : Allows usage of const keyword.
--angular_pass : Generate $inject properties for
AngularJS for functions annotated
with @ngInject
--charset VAL : Input and output charset for all
files. By default, we accept UTF-8 as
input and output US_ASCII
--closure_entry_point VAL : Entry points to the program. Must be
goog.provide'd symbols. Any goog.provi
de'd symbols that are not a transitive
tleunen / expandable-button.css
Created May 15, 2013
Create an expandable button in width, with 3 background image in css (left, middle and right parts). All this keeping the html very simple.
View expandable-button.css
.cbtn {
position: relative;
top: 0px;
left: 9px; /* width of left part (:before) */
overflow: visible; /* this make the :before and :after in position:absolute to appear */
background: url(img/middle.png);
height: 50px;
padding: 0;
tleunen / ahref-expandable-button.css
Last active Dec 17, 2015
Create an expandable ahref button in width, with 3 background image in css (left, middle and right parts). All this keeping the html very simple.
View ahref-expandable-button.css
.cbtn {
position: relative;
top: 0px;
left: 9px; /* same as width of left part (:before) */
background: url(img/middle.png);
height: 50px; /* height of the background image */
color: #000;
tleunen / embed-gist-angularjs.html
Last active May 1, 2019
Here is a directive in AngularJS to embed a Gist. This technique uses an iframe to add the gist because AngularJS doesn't handle script tags inside a template. And even if it does (with jQuery), it won't work as expected because Gist uses document.write. The iframe solves both issues.
View embed-gist-angularjs.html
<!-- In your template -->
<div data-gist="{{gistId}}"></div>
tleunen / bit-reverse.js
Created Feb 3, 2013
Function to reverse the bits of a given integer
View bit-reverse.js
function bitRev(N) {
var r = 0;
val = 0;
while(N > 0) {
val = N&1;
N >>= 1;
r += val&1;
r <<= 1;
tleunen / static_webserver_nodejs.js
Last active Dec 12, 2015
Simple static files webserver in NodeJS (with SSL in comments)
View static_webserver_nodejs.js
var http = require('http'),
https = require('https'),
fs = require('fs'),
url = require('url');
var options = {
key: fs.readFileSync('ssl/server.key'),
cert: fs.readFileSync('ssl/server.crt')
You can’t perform that action at this time.