Skip to content

Instantly share code, notes, and snippets.

View schickling's full-sized avatar
Making the web better

Johannes Schickling schickling

Making the web better
View GitHub Profile
@schickling
schickling / load-script.js
Created June 6, 2014 14:16
Minimal dynamic javascript loader
function loadScript(src) {
var el = document.createElement('script');
el.setAttribute('src', src);
el.async = false;
document.body.appendChild(el);
}
[
'jquery.js',
'main.js',
@schickling
schickling / ENV.md
Last active August 29, 2015 14:03
One command working enviornment setup

This script automatically sets up my vim environment on any machine. For example in a docker container or an EC2 instance.

Dependencies

  • wget
  • vim
  • git

Usage

If you run in something like this:

perl: warning: Setting locale failed.   
perl: warning: Please check that your locale settings:   
        LANGUAGE = "en_US:en",   
        LC_ALL = (unset),   
        LC_MESSAGES = "en_US.UTF-8",   
        LANG = "en_US.UTF-8"   
    are supported and installed on your system.
@schickling
schickling / .travis.yml
Created July 23, 2013 19:56
Use CasperJS with GruntJS for Travis CI
language: node_js
node_js:
- 0.6
- 0.7
- 0.8
- 0.9
- 0.10
before_script:
- npm install -g grunt-cli
- curl -L https://github.com/n1k0/casperjs/archive/1.0.3.tar.gz | tar xz
@schickling
schickling / disable-sidekiq.rb
Created October 5, 2013 08:15
Disable sidekiq for testing
# disable sidekiq calls
module Sidekiq::Worker::ClassMethods
def perform_async(*args)
nil
end
end
data Tree = Branch [Tree]
deriving Show
{- first int is the min cover; second int is the min cover that includes the root -}
minVC :: Tree -> (Int, Int)
minVC (Branch subtrees) = let
costs = map minVC subtrees
minWithRoot = 1 + sum (map fst costs) in
(min minWithRoot (sum (map snd costs)), minWithRoot)
@schickling
schickling / virtualbox.md
Created November 19, 2013 17:58
Remove old/inaccessible Virtualbox VMs

Remove old/inaccessible Virtualbox VMs

VBoxManage list vms # identify inaccessible VM
VBoxManage unregistervm 37b94dab-33a6-42c0-a2f2-78cb1f8bb880 # your UUID
@schickling
schickling / request.graphql
Last active May 26, 2016 22:44
Connections, Edges & Nodes in Relay (Relay Request + Response)
{
movie(title: "Inception") {
releaseDate
actors(first: 10) {
edges {
node {
name
}
}
}
@schickling
schickling / request.graphql
Last active May 26, 2016 22:44
Connections, Edges & Nodes in Relay (Simple GraphQL Request + Response)
{
movie(title: "Inception") {
releaseDate
actors {
name
}
}
}
@schickling
schickling / bluebird-concurrency.js
Created December 23, 2016 17:54
Runs multiple GraphQL mutations concurrently with a maximum number of parallel promises
import * as Bluebird from 'bluebird'
const myMutations = [
'mutation1: createItem(title: "Node 1") { id }',
'mutation2: createItem(title: "Node 2") { id }',
// ...
]
const transport = new Transport('my-graphcool-api')
const crm = new Lokka({transport})