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
| # create the template | |
| template = PageOfflineTemplate.new | |
| template.quote = quote | |
| template.pages = quote.build_pages | |
| # Here I render a template with layout to a string then a PDF | |
| pdf = PDFKit.new template.render_to_string(:template=>"quotes/review.html.haml") | |
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 './lib/enthuse/social_network_mappings' | |
| require 'virtus' | |
| class Authenticator | |
| # Required for Errors & Messages | |
| ########################################## | |
| include Virtus | |
| extend ActiveModel::Naming | |
| include ActiveModel::Conversion | |
| include ActiveModel::Validations |
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 'virtus' | |
| class Authenticator | |
| # Required for Errors & Messages | |
| ########################################## | |
| include Virtus | |
| extend ActiveModel::Naming | |
| include ActiveModel::Conversion | |
| include ActiveModel::Validations |
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
| export PATH="/Users/brendanmurphy/bin:$PATH:." | |
| [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" | |
| alias be="bundle exec" | |
| alias rdb="bundle install; bundle exec rake db:drop; bundle exec rake db:create; bundle exec rake db:migrate; bundle exec rake db:test:prepare" | |
| alias rdbi="rdb; import_backup; be rake db:migrate; be rake db:test:prepare" | |
| # rails | |
| alias rs="rails s" |
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 'rest_client' | |
| require 'json' | |
| class Artwork | |
| def fetch(query) | |
| api_key = '82a7531b6438492cd9e967442e5b12c8' | |
| album = RestClient.get("http://ws.audioscrobbler.com/2.0/?method=album.search&album=#{query}&api_key=#{api_key}&format=json") | |
| album = JSON.parse(album) | |
| results = album.fetch('results').fetch('albummatches').fetch('album')[0].fetch('image').last.fetch('#text') | |
| print results.to_s + "\n" |
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
| export PATH="/Users/brendanmurphy/bin:$PATH:." | |
| [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" | |
| export PATH="/usr/local/bin:$PATH:/usr/local/bin" | |
| export PATH="/usr/local/heroku/bin:$PATH" | |
| # Enthuse | |
| alias enthuse="cd ~/work/Enthuse" | |
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 'pry' | |
| RSpec.describe " example iterator " do | |
| class ATest | |
| def call(args = {}) | |
| args[:a] = "this was at A" | |
| args[:b] = "this should not happen" | |
| args[:c] = "this should not happen" |
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
| ADF.SpaceImageUploadView = Ember.View.extend( | |
| didInsertElement: -> | |
| _this = this | |
| this.$("input.image_uploader").on('click', -> | |
| storePath = "/space/#{_this.get('controller.model.id')}/images/" | |
| filepicker.pickAndStore({multiple: true, folders: true, mimetype: 'image/*', isWriteable: false}, {path: storePath, container: 'adoorfor'}, (data) -> | |
| _.each(data, (rawData) -> | |
| _this.resizeImage(rawData) | |
| ) | |
| ) |
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
| sudo apt-get update | |
| sudo apt-get install docker.io | |
| sudo ln -sf /usr/bin/docker.io /usr/local/bin/docker | |
| curl -L https://github.com/orchardup/fig/releases/download/0.4.1/linux > /usr/local/bin/fig | |
| chmod +x /usr/local/bin/fig |
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
| def self.find_or_next(id) | |
| find(id) | |
| rescue ActiveRecord::RecordNotFound | |
| if (id == last.id + 1) then raise ActiveRecord::RecordNotFound; end | |
| find(id+1) | |
| end |
OlderNewer