Skip to content

Instantly share code, notes, and snippets.

Avatar

Philip Poots pootsbook

  • ClubCollect
  • Alphen aan den Rijn, NL
View GitHub Profile
@bryanaka
bryanaka / hybrid-resolver.js
Last active August 29, 2015 14:14
Ember-Rails to Ember CLI
View hybrid-resolver.js
import Ember from 'ember';
import EmberResolver from 'ember/resolver';
var Em = Ember;
var HybridResolver = EmberResolver.extend({
resolveOther: function(parsedName) {
var factory = this.resolveGlobal(parsedName);
if(factory) { return factory; }
View gist:023b84f2002a39ae6c53
// declaration
function foo (n) { return n + 1; }
// expression
// note, fat arrow functions have very different meaning (usually what I want, though)
var foo = function (n) { return n + 1; };
var foo = (n) => { return n + 1; };
var foo = n => n + 1;
// object methods
View upload.js
import Ember from 'ember';
import XHR from 'ember-xhr';
/**
* On the rails server, this creates an active record that stores the
* filename and generates the pre-signed url, the return format is
* something like:
*
* {
* "upload": {
@byrichardpowell
byrichardpowell / gist:3857905
Created October 9, 2012 10:44
Model Fetch Unit Test
View gist:3857905
describe("A Model should", function() {
// FETCH
describe( "have a fetch method that", function() {
beforeEach(function() {
urls = ['url1', 'url2', 'url3', 'url4', 'url5']
spyOn( $, 'ajax');
@eccegordo
eccegordo / intro-to-ember-cli-node.md
Created March 21, 2015 11:14
Introduction to Ember CLI, Node and NPM
View intro-to-ember-cli-node.md

Introduction To Node, NPM and Ember CLI

This guide is for developers who are new Node, NPM, and Ember CLI. This guide is designed to get you started with ember cli development and provide some general background info on what Node is and how it works with Ember CLI.

Overview

  • What is Node?
  • What is NPM?
  • How do I setup my environment if I don't have node js or npm installed?
  • I accidently installed something wrong how can I start over?
View Main.elm
module Main where
import Signal
import Time exposing (Time, millisecond)
import String
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import Effects exposing (Never, Effects)
View usage.rb
NewPersonValidator = Validator.define do
validates_presence_of :name
end
class Person
attr_accessor :name
def initialize(name); @name = name; end
end
person = Person.new("Frank")
@gilesbowkett
gilesbowkett / remotes.bash
Created May 1, 2013 20:54
github help article implemented as shell script. is there an easier way?
View remotes.bash
# based on the workflow from https://help.github.com/articles/syncing-a-fork
function fetch_remotes() {
for remote in $(echo $(git remote))
do
git fetch $remote
done
}
function hub_sync() {
@anthonysterling
anthonysterling / destroy-vagrant.sh
Created May 22, 2013 09:48
Finds all running Vagrant instances, recursively, from with in the current folder. It then shuts them down, deletes the VM, and removes the .vagrant file.
View destroy-vagrant.sh
#!/usr/bin/env bash
for config in `find . -type f -name .vagrant`
do
uuid=`cat "$config" | php -r 'echo json_decode(fgets(STDIN))->active->default;'`
if VBoxManage showvminfo $uuid > /dev/null 2>&1; then
if VBoxManage showvminfo $uuid --machinereadable | egrep -q 'VMState="running|paused|stuck"'; then
VBoxManage controlvm $uuid poweroff
fi
VBoxManage unregistervm $uuid --delete
rm -f "$config"
@robertknight
robertknight / elm-setup-notes.md
Created November 14, 2015 07:29
Elm setup notes
View elm-setup-notes.md

Elm Tutorial Notes

  1. Went to elm-lang hopepage, skimmed the initial instructions, went for the Install option so I could develop in my preferred editor (Atom).
  2. Not obvious where to go next after that, went to the Docs link at the top. Was expecting to find an 'Intro to Elm' guide. In lieu of that, picked the next most obvious thing which was walking through the Quick Start links.