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
| s = document.createElement('script'); | |
| s.setAttribute('src','http://prose.atevans.com/bookmarklet.js'); | |
| document.head.appendChild(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
| #!/usr/bin/env ruby | |
| require 'open3' | |
| # things herbalizer hates: | |
| # nested hashes: %div{data: {href: src }} -> %div{data: Hash[href: src] } | |
| # comments in the first line | |
| # blank first line | |
| # ruby-style interpolation: Message to #{person} -> Message to \ = person | |
| # ternary operators inside blocks: %div{href: one ? two : three } -> put on separate line |
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
| module Blunder | |
| # Centralizes error reporting, so we don't get custom | |
| # library names like BugSnag or Errplane all over our code | |
| def self.oops(exception, custom_data = {}) | |
| raise if Rails.env == 'test' | |
| exception = Exception.new(exception) unless exception.is_a?(Exception) | |
| custom_data = custom_data.with_indifferent_access | |
| Rails.logger.error("\n\nBlunder Exception: #{exception}") | |
| Rails.logger.error("backtrace:#{exception.backtrace.take(20).join("\n")}\n\n") if exception.backtrace.present? | |
| env = custom_data.delete(:env) |
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
| namespace :static do | |
| desc "Generate and upload static pages" | |
| task :generate do | |
| `jekyll build -s jekyll -d jekyll/_site` | |
| `cp -r jekyll/_site/* public/` | |
| config = YAML.load(File.read(File.join(File.dirname(__FILE__), '..', '..', 'config', 'keys.yml'))) | |
| config = config['production']['amazon'] | |
| AWS.config(:access_key_id => config['key'], :secret_access_key => config['secret']) | |
| s3 = AWS::S3.new |
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
| namespace :find do | |
| desc "Find and replace" | |
| task :replace, :find, :replace do |t, args| | |
| find = args[:find] | |
| replace = args[:replace] | |
| `egrep -lRZ "#{find}" --exclude-dir='.git' --exclude-dir='db' --exclude-dir='tmp' --exclude-dir='images' --exclude-dir='fonts' --exclude-dir='vendor' . | xargs -I {} sed -i '' -e 's/#{find}/#{replace}/g' {}` | |
| 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
| var d = new Date(); | |
| var tz_offset = d.getTimezoneOffset(); // seconds, not ms, because Javascript | |
| var tz_select = $('#tz-select'); | |
| var abbr = tz_select.find("option[data-offset='" + tz_offset + "']").data('abbreviation'); |
This file has been truncated, but you can view the full file.
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
| Fetching repository, done. | |
| -----> Node.js app detected | |
| PRO TIP: Specify a node version in package.json | |
| See https://devcenter.heroku.com/articles/nodejs-support | |
| -----> Defaulting to latest stable node: 0.10.31 | |
| -----> Downloading and installing node | |
| -----> Exporting config vars to environment |
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
| #!/usr/bin/env ruby | |
| site 'http://community.opscode.com/api/v1' | |
| cookbook 'sprout-rbenv', | |
| :github => 'pivotal-sprout/sprout-rbenv' | |
| cookbook 'sprout-ruby', | |
| :github => 'pivotal-sprout/sprout-ruby' |
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 MyController < ApplicationController | |
| def create | |
| @model = Model.new(model_params) | |
| # we have to call this here, to populate | |
| # errors on any other fields that might | |
| # be invalid | |
| @model.valid? | |
| if @model.model_attr == 'invalid' && !@model.in_state(:dont_care) |
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
| # Your init script | |
| # | |
| # Atom will evaluate this file each time a new window is opened. It is run | |
| # after packages are loaded/activated and after the previous editor state | |
| # has been restored. | |
| # | |
| # An example hack to log to the console when each text editor is saved. | |
| # | |
| # atom.workspace.observeTextEditors (editor) -> | |
| # editor.onDidSave -> |