Skip to content

Instantly share code, notes, and snippets.

View scott-ad-riley's full-sized avatar

Scott Riley scott-ad-riley

View GitHub Profile
@scott-ad-riley
scott-ad-riley / _usage.md
Last active September 5, 2017 14:08
Prepend the jira-ticket-id into your commits
  1. cd into a deliveroo repo directory
  2. run:
curl -s https://gist.githubusercontent.com/scott-ad-riley/0d774a70452bd5bb118638b7dbed0176/raw/dde71f9489f2d01a6f048ec58d6f7f4cf93f63ce/prepare-commit-msg.rb > ./.git/hooks/prepare-commit-msg
  1. That downloads the script in this gist (I promise) and puts it in a ./git/hooks/prepare-commit-msg file
  2. You'll need to run this for each repo

N.B. It currently throws and prevents you from committing if your commit message starts with a different ticket number to the branch you're on (i.e. if you pass it PAY-1234: some message and you're on a branch that doesn't start PAY-1234/...)

@scott-ad-riley
scott-ad-riley / links.js
Last active August 5, 2016 11:15
Rails/Generic JS Snippets
@scott-ad-riley
scott-ad-riley / file.md
Last active May 23, 2016 21:59
Javascript Project Setup/Docs

#Javascript Project Setup/Docs

##Stuff Covered Here

  • Webpack
  • Express
  • Mocha
  • Chai
  • Lodash
@scott-ad-riley
scott-ad-riley / class.rb
Last active March 5, 2016 17:56
Hash of Object Instance Variables (Ruby)
class myClass
# [initialize with instance variable assignments]
def to_hash
return Hash[self.instance_variables.map{|var_name| [var_name.to_s.delete("@"), eval(var_name.to_s)]}]
end
end
@scott-ad-riley
scott-ad-riley / example.rb
Created February 25, 2016 17:15
Ruby Class Inheritance
# First off, a parent has no idea about a child, it's behaves as if it doesn't exist
# calling a method "super" inside of a class that inherits from another class, will call
# that same method it is inside, in the parent (with the arguments you pass to it)
# so in this case, in the child, it calls the initialize() method from the parent.
# It's important to realise that you still have a object of the child class, so despite
# the names I gave them, @parent_var_one and @parent_var_two are actually instance variables
# for your Child class and all behaviours/methods inside of Parent are carried down into (but
# can be overwritten by) Child.
class Parent
@scott-ad-riley
scott-ad-riley / create_specs.sh
Last active February 25, 2016 21:33
Create Ruby specs
#!/bin/bash
if [ ! -d "specs" ]; then
mkdir "specs"
fi
for file in *.rb
do
echo "require('minitest/autorun')" >> "specs/${file/.rb/}"_spec.rb
@scott-ad-riley
scott-ad-riley / endpoint.cfm
Last active February 25, 2016 09:53
Bug with CF serializeJSON and CF implicit type conversion that breaks things.
<!--- content with header application/json comes through as binary --->
<cfoutput>
#toString(getHttpRequestData().content)#
</cfoutput>