Skip to content

Instantly share code, notes, and snippets.

View chrisber's full-sized avatar

Christian Karl Bernasko chrisber

View GitHub Profile
@oldrev
oldrev / tsast2lambdas.ts
Created January 10, 2018 08:00
Typescript Expression Tree to Lambda Expression
function visitAndExpression(exprNode: any): any {
const conditions = exprNode.expressions.map(function (expr: any) { return visitExpression(expr) })
return function (it: any) { return conditions.every(function (c: any) { return c(it) }) }
}
function visitOrExpression(exprNode: any): any {
const conditions = exprNode.expressions.map(function (expr: any) { return visitExpression(expr) })
@ceremcem
ceremcem / unlocking-root-partition-over-ssh.md
Last active July 31, 2021 14:48
How to unlock LUKS root partition on boot via SSH
@kripken
kripken / hello_world.c
Last active January 17, 2024 12:15
Standalone WebAssembly Example
int doubler(int x) {
return 2 * x;
}
@come-maiz
come-maiz / snappy-dragonboard-tests.md
Last active September 4, 2019 12:28
Snappy images testing

Create the model:

$ cat dragonboard-model.json
{
    "type": "model",
    "authority-id": "$account_id",
    "brand-id": "$account_id",
    "series": "16",
    "model": "dragonboard",

"architecture": "arm64",

@btroncone
btroncone / rxjs_operators_by_example.md
Last active July 16, 2023 14:57
RxJS 5 Operators By Example
import { createStore, applyMiddleware } from 'redux';
import { Observable, Subject } from 'rxjs';
const api = type => {
console.log(`calling API ${type}`);
return new Promise(res => setTimeout(() => res(), 500));
};
const actionOrder = (actions, order) => actions.every((action, index) => action.type === order[index]);
const actionPredicate = actions => filterableAction => actions.some(action => action === filterableAction.type);
@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));
@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))]))))
@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

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