Skip to content

Instantly share code, notes, and snippets.

View paldepind's full-sized avatar

Simon Friis Vindum paldepind

  • Copenhagen, Denmark
  • 20:38 (UTC +02:00)
View GitHub Profile
@140bytes
140bytes / LICENSE.txt
Created May 9, 2011 16:13
140byt.es -- Click ↑↑ fork ↑↑ to play!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@tkissing
tkissing / LICENSE.txt
Created November 8, 2011 07:45 — forked from 140bytes/LICENSE.txt
mstc - mustache style templating compressed to (less than) 140byt.es
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Timo Kissing http://kissing.name
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@cmeiklejohn
cmeiklejohn / .fonts.conf
Created November 18, 2011 02:57
fix debian chrome/chromium hinting problems since it doesn't obey the normal gnome settings
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="font" >
<edit mode="assign" name="rgba" >
<const>none</const>
</edit>
</match>
<match target="font" >
<edit mode="assign" name="hinting" >
var $compileCache = function ($http, $templateCache, $compile) {
var cache = {};
return function (src, scope, cloneAttachFn) {
var compileFn = cache[src];
if (compileFn) {
compileFn(scope, cloneAttachFn);
} else {
$http.get(src, { cache: $templateCache }).success(function (response) {
var responseContents = angular.element('<div></div>').html(response).contents();
@twokul
twokul / hidden-classes-in-js-and-inline-caching.md
Last active April 23, 2024 22:02
Hidden classes in JavaScript and Inline Caching

Hidden classes in JavaScript and Inline Caching

Knowing how internals work is always a good. Pretty much for everything. Cars, trains, computers, you name it. It gives you an insight on what happens under the hood. You also act/react differently based on this knowledge.

As you might have guessed, it’s also true for web development. Knowledge of CSS transitions allows you to achieve better performance and not to use JavaScript in most cases. Knowledge of V8 internals allows you to write more performant JavaScript code. So let’s talk about V8 a little.

A little about V8

V8 is a JavaScript engine built by Google. Firefox built SpiderMonkey, Opera built Carakan and Microsoft built Chakra. One very important difference between V8 and other JavaScript engines is that V8 doesn’t generate any intermediate code. It compiles JavaScr

import Window
import Mouse
main = render <~ Window.dimensions ~ allMoves
mousePos =
let nomalize = \(w,h) (x,y) -> (toFloat x - toFloat w / 2, toFloat h / 2 - toFloat y)
in nomalize <~ Window.dimensions ~ Mouse.position
mouseDownAndPos = lift2 (,) Mouse.isDown mousePos
@danharper
danharper / gulpfile.js
Last active April 11, 2024 08:31
New ES6 project with Babel, Browserify & Gulp
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var browserify = require('browserify');
var watchify = require('watchify');
var babel = require('babelify');
function compile(watch) {
var bundler = watchify(browserify('./src/index.js', { debug: true }).transform(babel));
@pH200
pH200 / cycle.js
Last active July 6, 2017 05:30
Small Todo by using Cycle.js
import Cycle, {Rx, h} from 'cyclejs';
Cycle.registerCustomElement('TodoList', (rootElem$, props) => {
let vtree$ = props.get('items$').map(items =>
h('div', h('ul', items.map((itemText, index) =>
h('li', { key: index + itemText }, itemText)))));
rootElem$.inject(vtree$);
});
let vtree$ = Cycle.createStream(function (interaction$) {
@raine
raine / ramda
Last active May 4, 2020 12:14
Browse Ramda documentation in Terminal
#!/usr/bin/env bash
# Browse Ramda documentation in Terminal
# Requires jq and a tool such as fzf or peco for interactive filtering
LATEST="http://raine.github.io/ramda-json-docs/latest.json"
DOCS_URL="http://ramdajs.com/docs/"
json=$(curl -s $LATEST)
functions=$(echo "$json" | jq -r '.[] | if .sig and (.sig | length > 0) then .name + " :: " + .sig else .name end')
@alexeygolev
alexeygolev / _record-syntax.js
Last active August 29, 2015 14:26
Extra stuff for union types
const Color = Type({RGB:[Number, Number, Number], CMYK:[Number, Number, Number, Number]});
const Color_ = Type({RGB:{Red: Number, Green: Number, Blue: Number}, CMYK:{Cyan: Number, Magenta: Number, Yellow: Number, Black:Number}});
const {Person} = Type({Person: {name: String, id: Number, leftEyeColor: Color_, rightEyeColor: Color}});
let person = Person({name: 'John', id: 1, leftEyeColor: Color.RGB(255,100,255), rightEyeColor: Color_.CMYK({Cyan: 50, Magenta: 80, Yellow: 10, Black: 25})});
let personWithoutEyes = Person('John', 2);
let person2 = personWithoutEyes(Color.RGB(100,100,100), Color.CMYK(30,30,30,0));