Skip to content

Instantly share code, notes, and snippets.

View leoallen85's full-sized avatar

Leo Allen leoallen85

  • Makers Academy
  • London, UK
View GitHub Profile
class User < ActiveRecord::Base
# ...
def send_sms(message)
twilio = Twilio::REST::Client.new(Rails.application.config.twilio_account_id)
args = {
to: phone_number,
body: message
class SMSController < ApplicationController
def create
user = User.find(params[:id)
twilio = Twilio::REST::Client.new(Rails.application.config.twilio_account_id)
args = {
to: user.phone_number,
body: params[:message]
}
class Proposition
def initialize(sentence)
@sentence = sentence
end
def false?
subject.false?
end
def subject
class Proposition
def initialize(sentence)
@sentence = sentence
end
def false?
subject.false?
end
def subject
class Proposition
def initialize(sentence)
@sentence = sentence
end
def false?
subject.false?
end
def subject
@leoallen85
leoallen85 / async_and_callbacks.js
Created March 23, 2016 13:17
Exercises for understanding asynchronous JS and callbacks.
// Callbacks
// Complete this function so that it passes the numbers 1 and 2 into the callback
function two_numbers(callback){
// TODO
}
two_numbers(function(x, y){
console.log(x, y);
}
counterApp.controller('CounterCtrl', function(){
// You'll need to explain this
var self = this;
// Start with basic two-way data binding
self.count = 0;
// Now add buttons
self.increment = function() {
self.count++;
# improve colors
set -g default-terminal 'xterm-256color'
unbind r
bind r source-file ~/.tmux.conf
# act like vim
setw -g mode-keys vi
bind h select-pane -L
Questions
# Passion
If you studied history, why did you end up becoming a coder?
If you could teach yourself to learn to code, why not something else?
# Interest
Which programmers do you look up to?
require "./lib/journey_log"
class Oystercard
MAXIMUM_BALANCE = 90
MINIMUM_BALANCE = 1
attr_reader :balance, :journey, :journey_log
def initialize(journey_log: JourneyLog.new)