Skip to content

Instantly share code, notes, and snippets.

View joncode's full-sized avatar
🏠
Launching Apps

Jon Anders joncode

🏠
Launching Apps
  • Splice / Lucera / Couchtour.tv / Hedera / Giftlocal / Sarson Funds
  • Philadelphia, PA
View GitHub Profile
@joncode
joncode / gist:5818017
Created June 19, 2013 21:03
to look at a table scheme in PG in heroku && change a table type Production or Staging --- POSTGRESQL
1. first run the pg version of dbconsole in heroku by using this command :
heroku pg:psql --remote heroku (<staging>)
2. list the tables in psql by using this command
\dt
3. get the proper name of the table and list the schema by using this command
@joncode
joncode / gist:5689030
Last active December 17, 2015 23:29
Deploying a Rails 4 application / with ruby 2 / foundation 4 / secret ENV variable / staging area

basic setup


tasks:

  1. set up rvm gemset environment

    rvm --rvmrc --create 2.0.0@global

  2. run rails new

    rails new mdot

  3. change gemfile to specifically ask for ruby 2.0

Let’s assume we have an existing project called ‘foo’ and we want to create a fork called ‘bar’.

First, create a new project on GitHub called ‘bar’.

Next, clone foo using the name ‘bar’:

$ git clone [email protected]:YOURNAME/foo.git bar
$ cd bar

Next, edit your Git config file and replace the origin URL with your new URL:

@joncode
joncode / gist:5645816
Created May 24, 2013 19:08
EXC_BAD_ACCESS
fix with build edit scheme > diagnostics > enable NS zombie objects
will put a zombie (blank) object where the missing objet is and give you a error msg as to where the problem is
@joncode
joncode / gist:5622182
Created May 21, 2013 18:39
Resque - Redis
resque-web --- launch the web inteface
to have Resque available on the website :
mount the Resque::Server to the routes
add the server requirement to the resque gem
add HTTP authentication to the Resque::Server
@joncode
joncode / gist:5594304
Last active January 12, 2017 23:18
STAGING environment creation
1. make staging.rb in config/environments - copy production.rb for starters
2. in database.yml , application.yml , cloudinary.yml ... any .yml file , copy the production block and name it staging
2b. if you are using Resque - make a staging env in initializers/resque.rb
2c. add staging constants for any system-wide URLs
3. heroku create --remote staging <staging_app_name> --addons [any add ons here].
create the staging area of the config file
<staging_app_name> is the part of the url before '.herokuapp.com' -- muy importante , dont forget
4. heroku config:add RACK_ENV=staging RAILS_ENV=staging --remote staging
set up the rails environment vars
5. git push staging master
@joncode
joncode / gist:5529993
Created May 7, 2013 03:02
staging server on heroku
git config heroku.remote staging
sets the normal heroku commands to the heroku environment
heroku apps:create <name> --remote staging
heroku config:set RACK_ENV=staging RAILS_ENV=staging --remote staging
@joncode
joncode / gist:5178468
Created March 16, 2013 21:46
Removing the ruby return values from calls - good for avoiding the data dump in console
You can either put
gs = Gift.all;
or
gs = Gift.all; nil
the second one is a little better as it terminates the method , the first one starts a block like behavior in the console
@joncode
joncode / gist:4237122
Created December 7, 2012 22:40
getting github branches on your local computer
git remote show origin
git pull
git checkout remotes/origin/branchname
git checkout -b branchname
@joncode
joncode / gist:4191926
Created December 3, 2012 00:54
loading a ruby file in Rails Console
simple as load "test/buy_giver.rb"
this file is in the test folder in my rails app