Skip to content

Instantly share code, notes, and snippets.

@amelialaundy
amelialaundy / update_git_branches.sh
Last active August 27, 2018 21:22
pull all changes to given branch for upstream git repos in a folder, default to merge from 'develop' into current branch
#!/bin/bash
[[ $2 = "" ]] && BRANCH_NAME="develop" || BRANCH_NAME="$1"
# Let the person running the script know what's going on.
echo "Pulling in latest changes for all upstream repositories in $pwd..."
echo $BRANCH_NAME;
# Find all folders and update it to the given branch latest revision
for d in */ ; do
@amelialaundy
amelialaundy / gist:485c8df307e34dcdda2c6898406237d6
Last active March 10, 2018 04:13
get all colours available in terminal and their corresponding number https://github.com/sorin-ionescu/prezto/tree/master/modules/spectrum
#!/bin/bash
color(){
for c; do
printf '\e[48;5;%dm%03d' $c $c
done
printf '\e[0m \n'
}
IFS=$' \t\n'
color {0..15}
using System;
using System.Collections;
namespace StackQueue
{
public class Stack
{
List <object> store = new List<object>();
public void Push(object x)
@amelialaundy
amelialaundy / gist:4188b3e6c9d9e34236e0
Created September 19, 2014 04:31
unrefactored_js
function View() {
this.searchButton = document.querySelector(".search-button")
this.tagSpace = document.querySelector("#tag-space")
this.map = null
this.lat = 51.5072
this.lng = 0.1275
this.zoom = 2
this.address = null
}
function View() {
this.searchButton = document.querySelector(".search-button")
this.tagSpace = document.querySelector("#tag-space")
this.map = null
this.lat = 51.5072
this.lng = 0.1275
this.zoom = 2
this.address = null
}
class Game < ActiveRecord::Base
has_many :game_objects
after_create :generate_players
after_create :generate_jewels
before_create :overwrite_num_players
validates_presence_of :size, :num_players, :name
@amelialaundy
amelialaundy / gist:e26472926c83b1fd3f0f
Created September 12, 2014 05:01
amelia code example
class EventProcessor
def initialize
end
def self.process_all(json_array)
json_array.each do |action_info|
new.process(action_info)
end
end
@amelialaundy
amelialaundy / TDD.rb
Created August 11, 2014 03:28
Test Driven Development
# here's a simple example of driving your design using tests.
# by running this code and solving the failing tests one by one
# you should be able to finish this challenge easily.
# ask for help if you get stuck.
# consider all the questions (Q:) as you encounter them
# in this universe ...
# - people own pets
# - pets eat and walk
var Client = function(x,y,z,j){
this.name= x;
this.age= y;
this.quote= z;
this.showQuote = function() {
console.log(this.quote);
}
this.isFemale = j;
}