This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Group < ActiveRecord::Base | |
include ActiveDirectory | |
has_and_belongs_to_many :users | |
def members | |
@members ||= ldap_members(name) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/home/njr11/rmu/groupy/config/environments/development.rb:4: uninitialized constant SessionController (NameError) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'faraday' | |
class StravaGateway | |
def self.get_athlete(id) | |
response = Faraday.get("http://www.strava.com/athletes/#{id}") | |
body = response.body | |
name = body.slice(/<h1 class='topless' id='athlete-name'>(.+?)</, 1) | |
miles = body.slice(/<strong>(.+?)<abbr class='unit' title='miles'>/, 1) | |
hours = body.slice(/<strong>(.+?)<abbr class='unit' title='hours'>/, 1) | |
minutes = body.slice(/abbr>(.+?)<abbr class='unit' title='minutes'>/, 1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
mkdir -p ~/source/kata/$1 | |
cd ~/source/kata/$1 | |
project="$1.sublime-project" | |
project_dir=`pwd` | |
rspec --init | |
mkdir lib |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tip picked up from A lap around the Ember source code with Yehuda Katz | |
https://www.youtube.com/watch?v=RN_kVPga9y8 | |
Use: | |
import service from 'ember/injections'; | |
import on from 'ember/decorators'; | |
export default Ember.Component.extend({ | |
locale: service('locale'), | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ion-toolbar> | |
<ion-title> | |
Rates | |
</ion-title> | |
</ion-toolbar> | |
<ion-content padding> | |
<ion-card> | |
<ion-card-header>Money {{rate.direction}} • Daily Rate {{rate.dailyRate() | currency:'GBP':true:'1.2-2'}}</ion-card-header> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Storage, SqlStorage} from 'ionic/ionic'; | |
export class CustomStorage { | |
constructor() { | |
this.db = new Storage(SqlStorage); | |
} | |
getDB() { | |
return this.db._strategy._db; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Page, Modal} from 'ionic/ionic'; | |
import {InputModal} from './input-modal'; | |
import {RatesService} from './rates.service'; | |
@Page({ | |
templateUrl: 'app/rates/rates.html', | |
providers: [RatesService] | |
}) | |
export class Rates { | |
constructor(modal: Modal, rates: RatesService) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Page, Modal, NavParams} from 'ionic/ionic'; | |
import {RatesService} from './rates.service'; | |
@Page({ | |
templateUrl: 'app/rates/input-modal.html', | |
providers: [RatesService] | |
}) | |
export class InputModal { | |
constructor(modal: Modal, params: NavParams, rates: RatesService) { | |
this.modal = modal; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ion-item *ngFor="#rate of rates"> | |
<span item-left><h1 secondary>{{rate.direction}}</h1></span> | |
<h2>{{rate.description}}</h2> | |
<p>{{rate.amount | currency:'GBP':true:'1.2-2'}} • Every{{rate.days}} Days • {{rate.dailyRate | currency:'GBP':true:'1.2-2'}}</p> | |
<button clear danger item-right> | |
<icon trash></icon> | |
</button> | |
</ion-item> |
OlderNewer