Skip to content

Instantly share code, notes, and snippets.

View icholy's full-sized avatar
💥
breaking things

Ilia Choly icholy

💥
breaking things
View GitHub Profile
var FlatCoordinates = function () {
var FlatCoordinates = function FlatCoordinates (coordinates) {
this._coordinates = coordinates;
};
FlatCoordinates.prototype.shift = function () {
var c = this._coordinates;
c.shift();
c.shift();
var styleFunction = (function () {
var fill = new ol.style.Fill({ color: 'rgba(255, 255, 255, 0.5)' }),
stroke = new ol.style.Stroke({ color: '#319FD3', width: 1 }),
textFill = new ol.style.Fill({ color: '#000' }),
textStroke = new ol.style.Stroke({ color: '#fff', width: 3 }),
cache = {};
return function (feature, resolution) {
var text = resolution < 5000 ? feature.get('name') : '';
#!/bin/bash
#
# Author: Ilia Choly <ilia.choly@gmail.com>
# Year: 2014
#
if [[ -z "$1" ]]; then
echo "usage: graph_memory.sh <pid>"
exit 1
fi
var FN_ARGS = /^function\s*[^\(]*\(\s*([^\)]*)\)/m,
FN_ARG_SPLIT = /,/,
FN_ARG = /^\s*(_?)(\S+?)\1\s*$/,
STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
var fnSignature = function (fn) {
var fnText = fn.toString().replace(STRIP_COMMENTS, ''),
args = fnText.match(FN_ARGS);
if (!args) { return []; }
return args[1].split(FN_ARG_SPLIT).map(function (arg) {
package main
import (
"fmt"
"net/http"
"runtime/pprof"
"sync"
)
var (
(defmacro $ [&rest cmd]
(let [var? (fn [s] (s.startswith "$"))
rm-$ (fn [s] (slice s 1))
`@(map (fn [s] (if (var? s) (rm-$ s) `'~s))) cmd)
(let [test "hello"
data ($ cat foo | grep $test)]
(print data)
[
{
"song": "take it or leave it",
"artist": "cage the elephant"
},
{
"song": "afterlife",
"artist": "arcade fire"
},
{
<html>
<head>
<title>Change Image Color</title>
<style>
body { background-color: black; }
</style>
</head>
<body>
<canvas id="canvas"></canvas>
<script>
  • early return
  • noun first in variable name
  • use descriptive variable/parameter names
  • descriptive code over pretty code
  • composition over inheritance
  • many simple/short functions
  • be boring and explicit
  • declare close to usage
  • avoid global state
  • don't document what you're doing, document why
@icholy
icholy / keybase.md
Created September 22, 2014 16:41
keybase.md

Keybase proof

I hereby claim:

  • I am icholy on github.
  • I am icholy (https://keybase.io/icholy) on keybase.
  • I have a public key whose fingerprint is 3AA2 92C8 B490 087E 81CB D4F1 6111 83D4 99DB 8217

To claim this, I am signing this object: