Skip to content

Instantly share code, notes, and snippets.

View bradly's full-sized avatar

Bradly Feeley bradly

  • San Diego, California
View GitHub Profile
buffer = ''
cipher = nil
render :text => proc { |response, output|
s3.get(bucket, key_path) do |chunk|
# decrypt chunk
if buffer == ''
# first chunk
buffer << chunk
# extract the magic string and salt
magic_test = buffer.slice!(0..EncryptionHelper.magic_string.length-1)
pastie was soo 2007
e299a5efb88f2049276c6c20626520746865726520696e207468652066696e657374205475657364617920737765617465722120e299a5efb88f
@bradly
bradly / gist:bf0b55c0bd6faeac94f6
Created September 15, 2014 15:51
You don't trust me??
ruby -e 'puts `curl -s https://gist.githubusercontent.com/bradly/9b0536bd532718a0d22c/raw/d17a2106679a9f4034ba508ef388bf30b23ee54c/gistfile1.txt`.scan(/../).map { |c| c.hex.chr }.join'
package main
import "fmt"
import "os"
func main() {
source_dir_path := "/some/dir"
destination_dir_path := "/some/other/dir"
ensure_source_directory_exists(source_dir_path)
require 'uri'
class RootRelativeFilter < HTML::Pipeline::Filter
def call
doc.search("img").each do |img|
next if img['src'].nil?
src = img['src'].strip
if src.start_with? '/'
img["src"] = URI.join(context[:base_url], src).to_s
@bradly
bradly / duplicate_gem_dependancies.rb
Created March 21, 2015 04:17
Duplicate dependancies in Rubygems
#!/usr/bin/env ruby
spec = Gem::Specification.new do |s|
s.name = %q{event_calendar_engine}
s.version = "0.2.15"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Jason LaPier", "Jeremiah Heller"]
s.date = %q{2011-09-09}
s.description = %q{Provides basic event management features with versioned history of changes.}
@bradly
bradly / gist:cf46abac718dab8533db
Created April 4, 2015 18:57
ember new creating app in wrong directory
› cd ~/code
2.0.0-p481 in code/
› ember new wheres-waldo
Future versions of Ember CLI will not support v0.10.30. Please update to Node 0.12 or io.js.
version: 0.2.2
Could not find watchman, falling back to NodeWatcher for file system events.
Visit http://www.ember-cli.com/#watchman for more info.
installing
create .bowerrc
@bradly
bradly / gist:4232
Created August 6, 2008 16:23 — forked from defunkt/gist:4169
# by bryan helmkamp with slight modification by chris wanstrath
# from http://www.brynary.com/2008/8/3/our-git-deployment-workflow
module GitCommands
extend self
def diff_staging
`git fetch`
puts `git diff origin/production origin/staging`
end
- fields_for "profile[contact_attributes][]", contact do |c|
%label{:for => 'contact_first_name'} First Name
= c.text_field :first_name, :size => 25
%br
%label{:for => 'contact_last_name'} Last Name
= c.text_field :last_name, :size => 25
%br
%label{:for => 'contact_email'} Email Address
= c.text_field :email, :size => 25
%br