Skip to content

Instantly share code, notes, and snippets.

View yangtheman's full-sized avatar
🏠
Working from home

yangtheman

🏠
Working from home
View GitHub Profile
@yangtheman
yangtheman / phoenix_heroku_reset_db.md
Created December 21, 2017 07:39 — forked from ventsislaf/phoenix_heroku_reset_db.md
Reset database on Heroku running Phoenix app

Note: Don't do this on a production evniroment!

Get the heroku database name:

heroku pg:info

Name can be found in the reponse from the command above. For example: Add-on: soaring-newly-1337.

# brew install
brew install gnupg21
# $HOME/.bash_profile
export SSH_AUTH_SOCK="${HOME}/.gnupg/S.gpg-agent.ssh"
gpg-agent --daemon --enable-ssh-support
# $HOME/bin/restartgpg
killall gpg-agent
gpg-agent --daemon --enable-ssh-support
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X POST -d '{ "user": { "email": "test@email.com", "password": "password" } }' http://localhost:3000/users
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X POST -d '{ "email": "test@email.com", "password": "password" }' http://localhost:3000/users/sign_in
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'X-API-EMAIL: user@example.com' -H 'X-API-TOKEN: 2-D9jBtnAPcP8fppzJAL' -X GET http://localhost:3000/private_homes
@yangtheman
yangtheman / gist:7838217
Created December 7, 2013 07:14
Enable/disable user account on Windows 7
net user "user name" /active:no
net user "user name" /active:yes
@yangtheman
yangtheman / gist:7594851
Last active December 29, 2015 01:39
My ship wars code
function reset() {
turnTo(enemyBearing());
fire(enemyBearing());
turnTo(randomAngle());
warp(5);
}
var i = 0;
function update() {
@yangtheman
yangtheman / gist:5879742
Created June 27, 2013 19:48
mongoid.yml
development:
# Configure available database sessions. (required)
sessions:
# Defines the default session. (required)
default:
# Defines the name of the default database that Mongoid can connect to.
# (required).
database: vstandup_development
# Provides the hosts the default session can connect to. Must be an array
# of host:port pairs. (required)
@yangtheman
yangtheman / gist:4743311
Last active December 12, 2015 08:19
Installing Ruby 1.9.3 on Mountain Lion
# Install gcc-4.2.1 via brew
yangtheman:~$ brew install apple-gcc42
==> Downloading http://r.research.att.com/tools/gcc-42-5666.3-darwin11.pkg
######################################################################## 100.0%
==> Caveats
NOTE:
This formula provides components that were removed from XCode in the 4.2
release. There is no reason to install this formula if you are using a
@yangtheman
yangtheman / gist:3861115
Created October 9, 2012 20:08
Precompiling assets
yangtheman:~/ror/picpler(master)$ RAILS_ENV=production bundle exec rake assets:precompile
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /Users/yangtheman/ror/picpler/Rakefile:7)
/Users/yangtheman/.rvm/rubies/ruby-1.9.3-p194/bin/ruby /Users/yangtheman/.rvm/gems/ruby-1.9.3-p194/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.ru
@yangtheman
yangtheman / gist:3861053
Created October 9, 2012 19:57
500 error with not much error message
2012-10-09T19:54:46+00:00 app[web.1]: Rendered shared/_header.html.haml (75.4ms)
2012-10-09T19:54:46+00:00 app[web.1]: Rendered shared/_trackers.html.haml (14.5ms)
2012-10-09T19:54:46+00:00 app[web.1]: Rendered shared/_footer.html.haml (21.8ms)
2012-10-09T19:54:46+00:00 app[web.1]: Completed 500 Internal Server Error in 1374ms (Views: 167.4ms | ActiveRecord: 54.5ms)
2012-10-09T19:54:46+00:00 heroku[router]: GET www.picpler.com/places dyno=web.1 queue=0 wait=0ms service=1779ms status=500 bytes=5879
2012-10-09T19:54:46+00:00 heroku[router]: GET www.picpler.com/assets/application-b1a625acbad7bb91815d78c9195ab079.css dyno=web.1 queue=0 wait=1ms service=82ms status=200 bytes=156193
2012-10-09T19:54:46+00:00 heroku[router]: GET www.picpler.com/assets/application-49e2a5e977547ad2ab276eede7660f58.js dyno=web.1 queue=0 wait=0ms service=15ms status=200 bytes=384722
2012-10-09T19:54:49+00:00 heroku[router]: GET www.picpler.com/assets/picpler-icons.png dyno=web.1 queue=0 wait=0ms service=11ms status=200 bytes=35891
@yangtheman
yangtheman / gist:3385305
Created August 18, 2012 08:26
/etc/nginx/rubber/unicorn_nginx.conf
upstream unicorn_server {
# This is the socket we configured in unicorn.rb
server unix:/var/run/unicorn.sock
fail_timeout=0;
}
server {
listen 80;
client_max_body_size 4G;
server_name picpler.com;