Skip to content

Instantly share code, notes, and snippets.

View checkthemethod's full-sized avatar
🎯
Focusing

Richard Saethang checkthemethod

🎯
Focusing
View GitHub Profile
@kutyel
kutyel / facebook.js
Last active October 11, 2020 17:31
Question for my Frontend Interview at Facebook
/*
* Create an event emitter that goes like this
* emitter = new Emitter();
*
* Allows you to subscribe to some event
* sub1 = emitter.subscribe('function_name', callback1);
* (you can have multiple callbacks to the same event)
* sub2 = emitter.subscribe('function_name', callback2);
*
* You can emit the event you want with this api
@tisunov
tisunov / twitter_stylebot.css
Last active September 26, 2015 12:49
CLEAN UP TWITTER
/* CLEAN UP TWITTER
by @levelsio
use Stylebot Chrome extension to load this by default:;
https://chrome.google.com/webstore/detail/stylebot/oiaejidbmkiecgbjeifoejpgmdaleoha?hl=en
*/
/* Removes all borders in layout */
* {
border:none !important;
}
@abhishek77in
abhishek77in / heroku-db.sh
Last active December 16, 2018 03:36
Import heroku database to local machine
heroku pg:backups:capture --app sushi
curl -o latest.dump `heroku pg:backups public-url --app sushi`
curl -o latest.dump `heroku pg:backups:url b001 --app sushi`
pg_restore --verbose --clean --no-acl --no-owner -d <app_name>_development latest.dump
# Restore data from trial server
curl -o latest.dump `heroku pg:backups public-url --app labsmart-trial`
be rake db:drop db:create
pg_restore --verbose --clean --no-acl --no-owner -d azurite_development latest.dump
@micahroberson
micahroberson / estimate.rb
Created July 13, 2013 00:35
Generate and save a pdf to S3 with wicked_pdf and paperclip
# Main reference was lascarides' post at http://stackoverflow.com/questions/14743447/getting-pdf-from-wickedpdf-for-attachment-via-carrierwave
# estimate.rb
# ...
has_attached_file :pdf,
storage: :s3,
s3_credentials: {
access_key_id: ENV['AWS_ACCESS_KEY_ID'],
secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'],
bucket: ENV['AWS_BUCKET']
@hgmnz
hgmnz / dblink-demo
Created March 6, 2013 16:33
How to move data from one postgres database to another using dblink. Useful for cherry-picking data from a remote database
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')