Skip to content

Instantly share code, notes, and snippets.

View bradly's full-sized avatar

Bradly Feeley bradly

  • San Diego, California
View GitHub Profile
### Keybase proof
I hereby claim:
* I am bradly on github.
* I am bradly (https://keybase.io/bradly) on keybase.
* I have a public key whose fingerprint is 0490 C1ED 7D4F 4A2F 8B03 6D1C 8AFB 954D F7EE 3A2C
To claim this, I am signing this object:
@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 / 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.}
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
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)
@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'
e299a5efb88f2049276c6c20626520746865726520696e207468652066696e657374205475657364617920737765617465722120e299a5efb88f
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)
@bradly
bradly / active_record_singleton.rb
Created April 26, 2013 17:28
A simple lib to make an active record class work with a single row. Not sure how I feel about it yet, but it really came in handy in a current app.
module ActiveRecordSingleton
def self.included(base)
base.class_eval do
class << self
delegate :attributes, :save, :save!, :update_attribute, :update_attributes, :update_attributes!, :update_column, to: 'instance'
[:new, :create, :create!, :destroy, :destroy_all, :delete, :delete_all].each do |method_name|
undef_method method_name
end
<?php
// TimThumb script created by Tim McDaniels and Darren Hoyt with tweaks by Ben Gillbanks
// http://code.google.com/p/timthumb/
// MIT License: http://www.opensource.org/licenses/mit-license.php
/* Parameters allowed: */
// w: width