Skip to content

Instantly share code, notes, and snippets.

🍍
' OR '1'='1

David Jones djones

🍍
' OR '1'='1
Block or report user

Report or block djones

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@djones
djones / apply-guetzli.sh
Last active Mar 22, 2017
Applying Guetzli encoding to JPG images in bulk
View apply-guetzli.sh
brew install guetzli
cd your/images/directory
for file in **/**.jpg; do guetzli "$file" "$file"; printf '.'; done
View seeds.exs
alias PhoenixTodosApi.Repo
alias PhoenixTodosApi.Todo
Repo.insert!(%Todo{title: "Create the Phoenix App", is_completed: true})
Repo.insert!(%Todo{title: "Prepare the Ember App", is_completed: false})
Repo.insert!(%Todo{title: "Ensure the Apps Work Together", is_completed: false})
@djones
djones / add_handoff_to_orders.rb
Created Jun 10, 2014
Handoff in iOS 8 and OS X Yosemite with Spree Commerce
View add_handoff_to_orders.rb
# Generate this migration by running:
#
# bundle exec rails g migration add_handoff_to_spree_orders handoff:string
# bundle exec rake db:migrate
#
# db/migrate/add_handoff_to_orders.rb
class AddHandoffToOrders < ActiveRecord::Migration
def change
add_column :spree_orders, :handoff, :string
@djones
djones / gist:3281471
Created Aug 7, 2012
Xcode Experiments with ImageOptim and ImageAlpha
View gist:3281471
Ensure you first read http://imageoptim.com/xcode.html
Links: http://imageoptim.com - http://pngmini.com
Results when applying to Ace Rider:
(binary size)
40.4mb Xcode default
38.2mb ImageOptim
30.8mb ImageAlpha (256 colours)
@djones
djones / gist:2731965
Created May 19, 2012
Send screenshots to a screenshots directory on my desktop
View gist:2731965
mkdir ~/Desktop/screenshots
defaults write com.apple.screencapture location ~/Desktop/screenshots
# Log out and in again for it to take effect
@djones
djones / Grape + Goliath
Created May 10, 2012
Basic API app performance comparison: Rails + Thin VS Grape + Goliath
View Grape + Goliath
# Standard Grape API setup on a user model which uses ActiveRecord like the Rails example above.
# Goliath running in production mode.
# MySQL used for the database.
# Result: 1203.6 avg replies/s (with stddev 5.2)
$ httperf --server=localhost --port=9000 --uri=/users/1.json --num-conns=20 --num-calls=2000
httperf --client=0/1 --server=localhost --port=9000 --uri=/users/1.json --send-buffer=4096 --recv-buffer=16384 --num-conns=20 --num-calls=2000
httperf: warning: open file limit > FD_SETSIZE; limiting max. # of open files to FD_SETSIZE
Maximum connect burst length: 1
@djones
djones / gist:2642094
Created May 9, 2012
Grape API being served with Goliath
View gist:2642094
#!/usr/bin/env ruby
# gem install grape --pre
# http://localhost:9000/hello.json
# => {"hello":"world"}
$:<< '../lib' << 'lib'
require 'goliath'
@djones
djones / gist:2596822
Created May 4, 2012
Sudocode on how I would like Grape to work with Goliath
View gist:2596822
# Sudocode on how I would like grape to work with Goliath
# http://localhost:9000/randomuser #=> random user in json
require 'goliath'
require 'grape'
require 'em-synchrony/activerecord'
class User < ActiveRecord::Base
end
@djones
djones / coffee_hydration.rb
Created Apr 19, 2012
Does my coffee hydrate or dehydrate me?
View coffee_hydration.rb
# Do you hydrate or dehydrate your body when having a coffee?
# Constants based on references below
MG_OF_CAFFEINE_PER_SHOT = 77 # mg
SHOT_VOLUME = 44 # ml
WATER_PERCENT_IN_MILK = 87 # %
WATER_LOSS_FROM_CAFFEINE = 1.17 # ml/mg
# number_of_shots : standard single shot
# size_of_cup : in ml
@djones
djones / gist:2333134
Created Apr 8, 2012
Feedback regarding Refinery CMS
View gist:2333134
An email exchange regarding Refinery CMS
----------------------------------------
#1 Inquiry received on the Resolve Digital website
From: X
Email: X
I really cannot stop wondering how can you even dare to call something
like Refinery "a CMS". It amazes me even more that you combine that with
You can’t perform that action at this time.