Skip to content

Instantly share code, notes, and snippets.

View markprovan's full-sized avatar

Mark Provan markprovan

View GitHub Profile

Keybase proof

I hereby claim:

  • I am markprovan on github.
  • I am markprovan (https://keybase.io/markprovan) on keybase.
  • I have a public key ASBJKRg5xBbF-Qltr_xlR1T-7h8WU2uOqLRRCgZoWAowiAo

To claim this, I am signing this object:

heroku pg:backups restore `heroku pg:backups public-url --app production-app-name` DATABASE --app staging-app-name
update : Action -> Model -> Model
update action model =
case action of
Toggle seatToToggle ->
let
updateSeat seatFromModel =
if seatFromModel.seatNo == seatToToggle.seatNo then
-- Not working, compiler expects `=`
{ seatFromModel | occupied <- not seatFromModel.occupied }
@markprovan
markprovan / login.js
Created October 31, 2014 12:13
Context Error
import Ember from 'ember';
export default Ember.Controller.extend({
actions: {
login: function() {
var data = {email: this.get("email"), password: this.get("password")}
var _this = this;
$.post( "http://localhost:3000/sessions/create", data, function( response ) {
store = _this.store // _this is undefined
});
@markprovan
markprovan / gc_network_to_csv.rb
Created August 8, 2013 10:15
Convert Google Chromes Network anaylsis to csv. Right click and copy HAR, then save that file as json. `ruby gc_network_to_csv.rb network.json`
require "json"
require "csv"
filename = ARGV[0]
json = JSON.parse(File.read(filename))
CSV.open("#{filename.gsub('.json', '')}.csv", "w") do |csv|
csv << ["URL", "File Size"]
json["log"]["entries"].each do |r|
csv << [r["request"]["url"], r["response"]["content"]["size"]]
#!/usr/bin/env bash
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline5-dev libyaml-dev
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p195.tar.bz2
tar xvjf ruby-2.0.0-p195.tar.bz2
cd ruby-2.0.0-p195/
./configure --prefix=/usr/local
make
make install
@markprovan
markprovan / example.html
Last active December 16, 2015 21:58 — forked from jonbca/example.html
<table>
<thead><tr><th>foo</th></tr></thead>
<tbody>
{{#each item in controller}}
<tr><td>{{item.name}}</td></tr>
{{else}}
<tr><td>You have no documents. How about you {{#linkTo create}}create one now{{/link}}?</td></tr>
{{/each}}
</tbody>
</table>
{{#each item in controller}}
{{item.name}}
{{else}}
There are no items!
{{/each}}
,lass User < ActiveRecord::Bas,
attr_accessible :email, :invite_accepted, :password_hash, :password_salt, :invite_token, :role, :account_id, :created_at, :forename, :surname, :job_title, :department, :standard_rate, :invite_status
attr_accessor :password
before_save :encrypt_password, :assign_invite_token
validates_confirmation_of :password
validates_presence_of :password, :on => :create
validates_presence_of :email
validates_presence_of :account
validates_uniqueness_of :email
filetype off
filetype plugin indent on
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
Bundle 'mattn/webapi-vim'
Bundle 'mattn/gist-vim'
Bundle 'vim-ruby/vim-ruby'