Skip to content

Instantly share code, notes, and snippets.

@KidkArolis
KidkArolis / nginx.conf
Last active August 29, 2015 14:07
Running node.js apps on Ubuntu
# /etc/nginx/sites-enabled/myapp.conf
# handle HTTPS and route the domain to specific apps
# proxy to the node app via port/socket
server {
listen 443;
server_name myapp.com;
@KidkArolis
KidkArolis / proxy.md
Created October 13, 2014 15:20
Use ssh as browser proxy
ssh somehost -D 6070

then point your browser to use socks5://locahost:6070 as a proxy

### Keybase proof
I hereby claim:
* I am kidkarolis on github.
* I am kidkarolis (https://keybase.io/kidkarolis) on keybase.
* I have a public key whose fingerprint is 2A78 00B6 4A70 5589 508A F52A 79DA 3FA4 82A4 C989
To claim this, I am signing this object:
@KidkArolis
KidkArolis / someComponent.js
Created December 1, 2014 21:56
api object
// How would you name options.api?
// What do you think of this pattern?
// The idea here is that the framework allows creating these UI components
// without enforcing much about how the component renders itself.
// By passing in the API object we don't enforce how the component is written
// and we enable the API object to provide some methods that affect specifically
// the given instance of the component without affecting other components.
// I know the context is a bit lacking here, but was wondering what your thoughts
@KidkArolis
KidkArolis / index.js
Created December 19, 2014 21:45
requirebin sketch
var Router = require("cherrytree");
var Route = require("cherrytree/route");
// some things we'll use to render the views
var $ = require("jquery");
var insert = require("insert-stylesheet");
var insertCss = require("insert-css");
var lorem = require("lorem-ipsum");
// style this a little bit
@KidkArolis
KidkArolis / timeout.js
Last active August 29, 2015 14:26
timeout.js
/**
* Usage:
*
* request("foo", timeout(function () {
* // get here after request completes, or 5 seconds,
* // whichever is first
* }, 5000));
*/
function timeout(done, duration) {
var alreadyCalled = false;
@KidkArolis
KidkArolis / index.js
Last active August 29, 2015 14:26
requirebin sketch
// require() some stuff from npm (like you were using browserify)
// and then hit Run Code to run it on the right
var sinon = require("sinon")
console.log(sinon)
window.sinon = sinon
/*
sinon.stub(window.history, "pushState", function () {
console.log("PUSHING")
})
@KidkArolis
KidkArolis / cherrytree-express-render.js
Last active August 29, 2015 14:27
render a react app in express using cherrytree
/**
* A generic render helper for cherrytree + react + express.
*
* To run this example locally:
*
* $ git clone https://github.com/QubitProducts/cherrytree.git
* $ cd cherrytree/examples/server-side-react
* $ npm install
* $ npm start
* $ open http://localhost:8000
@KidkArolis
KidkArolis / cherrytree-app.js
Last active August 29, 2015 14:27
a quick intro to the cherrytree router
/**
* To run this example locally:
*
* $ git clone https://github.com/QubitProducts/cherrytree.git
* $ cd cherrytree/examples/hello-world-react
* $ npm install
* $ npm start
* $ open http://localhost:8000
*
*/
@KidkArolis
KidkArolis / middleearth.js
Created August 10, 2015 19:44
cherrytree example middleware
router.use(loadingAnimation)
router.use(loadHandlers(router))
router.use(computeAlreadyActive)
router.use(modelHook)
router.use(activateHook)