Skip to content

Instantly share code, notes, and snippets.

@Carreau
Carreau / kernel.js
Created December 13, 2012 20:09
A node.js kernel for IPython notebook. You can see the explanation of the ipynb rendered in http://nbviewer.ipython.org
zmq = require("zmq")
fs = require("fs")
var config = JSON.parse(fs.readFileSync(process.argv[2]))
var connexion = "tcp://"+config.ip+":"
var shell_conn = connexion+config.shell_port
var pub_conn = connexion+config.iopub_port
var hb_conn = connexion+config.hb_port
@ygotthilf
ygotthilf / jwtRS256.sh
Last active June 11, 2024 02:25
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@microbial
microbial / rename.js
Last active May 17, 2024 01:54
lodash helpers - rename (renames object keys)
/*
* var person = { firstName: 'bill', lastName: 'johnson' }
*
* person = _.rename(person, 'firstName', 'first')
* person = _.rename(person, 'lastName', 'last')
*
* console.log(person) // { first: 'bill', last: 'johnson' }
*/
_.rename = function(obj, key, newKey) {
@Avaq
Avaq / combinators.js
Last active June 11, 2024 02:51
Common combinators in JavaScript
const I = x => x
const K = x => y => x
const A = f => x => f (x)
const T = x => f => f (x)
const W = f => x => f (x) (x)
const C = f => y => x => f (x) (y)
const B = f => g => x => f (g (x))
const S = f => g => x => f (x) (g (x))
const S_ = f => g => x => f (g (x)) (x)
const S2 = f => g => h => x => f (g (x)) (h (x))
@ezimuel
ezimuel / sign.sh
Created March 14, 2016 15:50
Sign and verify a file using OpenSSL command line tool. It exports the digital signature in Base64 format.
#!/bin/bash
# Sign a file with a private key using OpenSSL
# Encode the signature in Base64 format
#
# Usage: sign <file> <private_key>
#
# NOTE: to generate a public/private key use the following commands:
#
# openssl genrsa -aes128 -passout pass:<passphrase> -out private.pem 2048
# openssl rsa -in private.pem -passin pass:<passphrase> -pubout -out public.pem

Pitchfork’s Product team is hiring. We're looking for a sharp, creative front-end developer excited about pushing hard on UI and UX across all platforms. Your work will be seen daily by millions around the world, and you'll be a part of a small team of designers and developers whose work has been praised for redefining online music journalism and influencing the medium itself.

Our work environment is fast-paced and intimate: we all work very closely, and everyone has say in new ideas, features, and approach. You should be someone constantly learning about new technology and keenly aware of its practical applications and limitations. It should go without saying that you’re willing to take on any task, regardless of size or glory. Everyone here wears many hats, and no job is too small for anyone. Strong communication skills are a must, as is the desire to teach as much as you learn. A love for music doesn’t hurt, either.

Responsibilities

As part of Pitchfork’s Product team, you will help us

  • consistent
@tomsapps
tomsapps / FRP.MD
Last active November 16, 2016 16:09

Observable

Observables are producers that can return many values asynchronously

Producers determine when the values are sent (PUSH)

Observable executions are NOT shared

setTimeout(() => foo.subscribe)
foo.subscribe
@vadimshvetsov
vadimshvetsov / objectToDotNotation.js
Created May 25, 2017 11:56
Function for merging objects in find*Update function with one level nesting.
/**
* Consume update args object for document and can handle one level nesting.
* Returns object for leverage by $set in Mongoose update function.
*
* @param args
* @returns {{}}
*/
const objectToDotNotation = (args) => {
const setObject = {};
Object.keys(args).forEach((key) => {
@benjick
benjick / persist.js
Created June 15, 2017 11:09
mobx-state-tree persist PoC
/* globals localStorage */
import { onSnapshot, applySnapshot } from 'mobx-state-tree';
import Storage from './storage';
export const persist = (name, store, options, schema = {}) => {
let hydrated = false;
let storage = options.storage;
if (typeof localStorage !== 'undefined' && localStorage === storage) {
@jdkanani
jdkanani / decorators.js
Created August 2, 2017 11:06
Javascript decorators
export function sleepFor (timeInMilliSeconds = 1000) {
return new Promise((resolve, reject)=>{
setTimeout(resolve, timeInMilliSeconds);
});
}
export function waitFor (...names) {
return (target, prop, descriptor) => {
const fn = descriptor.value;
let newFn = function (...args) {