Skip to content

Instantly share code, notes, and snippets.

View chrisber's full-sized avatar

Christian Karl Bernasko chrisber

View GitHub Profile
@eendeego
eendeego / bindings-cheat-sheet.md
Created November 28, 2012 10:26
Node/V8 bindings cheat sheet
@bmount
bmount / Python-2.7.3-xcompile.patch
Created October 11, 2013 03:59
Cross compile python 2.7.3 for arm
diff -ur Python-2.7.3.orig/configure Python-2.7.3-Source/configure
--- Python-2.7.3.orig/configure 2012-04-09 19:07:36.000000000 -0400
+++ Python-2.7.3-Source/configure 2012-10-23 14:10:45.305220393 -0400
@@ -13697,7 +13697,7 @@
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
- ac_cv_have_long_long_format=no
+ ac_cv_have_long_long_format="cross -- assuming yes"
else
diff --git a/Makefile.pre.in b/Makefile.pre.in
index bcd83bf..efbfd8d 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -461,6 +461,7 @@ sharedmods: $(BUILDPYTHON) pybuilddir.txt
esac; \
$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
_TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
+ PYTHONXCPREFIX='$(DESTDIR)$(prefix)' \
$(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
@phrawzty
phrawzty / 2serv.py
Last active May 22, 2024 18:37
simple python http server to dump request headers
#!/usr/bin/env python2
import SimpleHTTPServer
import SocketServer
import logging
PORT = 8000
class GetHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
$(function() {
// good opportunity to combine into a single statement
// qq w cw <esc> A, <esc> 0 j q
var a = 10;
var b = 20;
var c = 30;
var d = 40;
var e = 50;
// opportunity to simplify syntax

Angular2 + JSPM cheat sheet

First time setup

  • install jspm beta: npm install -g jspm@beta
  • set up your project: jspm init
  • install dependencies: jspm install angular2 reflect-metadata zone.js es6-shim

This will create a jspm_packages folder, and a config.js file.

Open the config.js file - this file manages options for the System.js loader - tweak it as appropriate

@yurydelendik
yurydelendik / !wasmllvm.md
Last active February 23, 2024 05:08
Using WebAssembly in LLVM

NOTE: the content is out-of-date. All development is moved to the https://github.com/yurydelendik/wasmception

Using WebAssembly in LLVM

Compiling

# locations, e.g.
export WORKDIR=~/llvmwasm; mkdir -p $WORKDIR
export INSTALLDIR=$WORKDIR
@mgechev
mgechev / qs.clj
Last active November 13, 2015 05:59
Quick sort with ECMAScript array comprehensions
(defn qs [lst]
(let [[head & tail] lst]
(if (>= 1 (count lst))
lst
(flatten [(qs (for [x tail :when (<= x head)] x)) head (qs (for [x tail :when (> x head)] x))]))))
@Restuta
Restuta / the-bind-problem.jsx
Last active March 16, 2024 00:22
React, removeEventListener and bind(this) gotcha
/* Sometimes it's pretty easy to run ito troubles with React ES6 components.
Consider the following code: */
class EventStub extends Component {
componentDidMount() {
window.addEventListener('resize', this.onResize.bind(this)); //notice .bind
}
componentWillUnmount() {
window.removeEventListener('resize', this.onResize.bind(this));