This file contains 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
brew install guetzli | |
cd your/images/directory | |
for file in **/**.jpg; do guetzli "$file" "$file"; printf '.'; done |
This file contains 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
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}) |
This file contains 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
# 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 |
This file contains 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
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) |
This file contains 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
mkdir ~/Desktop/screenshots | |
defaults write com.apple.screencapture location ~/Desktop/screenshots | |
# Log out and in again for it to take effect |
This file contains 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
# 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 |
This file contains 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 | |
# gem install grape --pre | |
# http://localhost:9000/hello.json | |
# => {"hello":"world"} | |
$:<< '../lib' << 'lib' | |
require 'goliath' |
This file contains 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
# 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 |
This file contains 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
# 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 |
NewerOlder