Skip to content

Instantly share code, notes, and snippets.

View pazaricha's full-sized avatar
😇

Paz Aricha pazaricha

😇
View GitHub Profile
@pazaricha
pazaricha / gist:3848384
Created October 7, 2012 13:19 — forked from Gregg/gist:968534
Code School Screencasting Framework

Screencasting Framework

The following document is a written account of the Code School screencasting framework. It should be used as a reference of the accompanying screencast on the topic.

Why you should care about screencasting?

You're probably aren't going to take the time to read this document if you're not interested, but there are a lot of nice side effects caused by learning how to create quality screencasts.

  1. Communicating more effectively - At Envy Labs we produce screencasts for our clients all the time. Whether it's demoing a new feature or for a presentation for an invester, they're often much more effective and pleasent than a phone call or screen sharing.
@pazaricha
pazaricha / deploy.rake
Last active December 17, 2015 18:38 — forked from njvitto/deploy.rake
#Deploy and rollback on Heroku in staging and production
task :deploy_staging => ['deploy:set_staging_app', 'deploy:push_staging', 'deploy:restart', 'deploy:tag']
task :deploy_production => ['deploy:set_production_app', 'deploy:push_production', 'deploy:restart', 'deploy:tag']
namespace :deploy do
PRODUCTION_APP = 'YOUR_PRODUCTION_APP_NAME_ON_HEROKU'
STAGING_APP = 'YOUR_STAGING_APP_NAME_ON_HEROKU'
task :staging_migrations => [:set_staging_app, :push_staging, :off, :migrate, :restart, :on, :tag]
task :staging_rollback => [:set_staging_app, :off, :push_previous, :restart, :on]
@pazaricha
pazaricha / slug_rack_app.rb
Last active August 29, 2015 14:28 — forked from elado/slug_rack_app.rb
Rails conditional controller
# routes.rb (very bottom route):
match '*path' => SlugRackApp
# slug_rack_app.rb
class SlugRackApp
def self.call(env)
path = env["action_dispatch.request.path_parameters"][:path]
@pazaricha
pazaricha / flight.rb
Last active October 13, 2016 11:51 — forked from royzinn/flight.rb
class FlightManager
def self.search(search_criteria)
provider = search_criteria[:provider].camelize
flights = "FlightProviders::#{provider}".constantize.search_flights(search_criteria)
"FilghtsResponseAdapter::#{provider}".constantize.normazlize(flights)
end
end
## Have one of these for each unique provider/response
module FilghtsResponseAdapter
@pazaricha
pazaricha / postgres_queries_and_commands.sql
Created January 13, 2018 19:13 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@pazaricha
pazaricha / cmd.sh
Created December 20, 2018 12:19 — forked from kelvinn/cmd.sh
Example of using Apache Bench (ab) to POST JSON to an API
# post_loc.txt contains the json you want to post
# -p means to POST it
# -H adds an Auth header (could be Basic or Token)
# -T sets the Content-Type
# -c is concurrent clients
# -n is the number of requests to run in the test
ab -p post_loc.txt -T application/json -H 'Authorization: Token abcd1234' -c 10 -n 2000 http://example.com/api/v1/locations/
@pazaricha
pazaricha / Map.Helpers
Created September 22, 2020 21:04 — forked from kipcole9/Map.Helpers
Helpers for Elixir Maps: underscore, atomise and stringify map keys
defmodule Map.Helpers do
@moduledoc """
Functions to transform maps
"""
@doc """
Convert map string camelCase keys to underscore_keys
"""
def underscore_keys(nil), do: nil