This file contains hidden or 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
1. If you are trying to `go get` a private repo, you need to be able to enter your `username` and `password` from the prompt. | |
To get the prompt you need to enable the git terminal prompt. | |
env GIT_TERMINAL_PROMPT=1 go get 'github.com/the-user/the-repo' | |
2. Because of 2FA you cannot use your password. You need to generate an access token and enter that in the password field | |
instead (you will want to copy at the clipboard on the token generation page, b/c it will be long). To generate the token, go | |
to [https://github.com/settings/tokens/new](https://github.com/settings/tokens/new). Or from the Github UI, | |
` Setting - Developer Settings - Personal access tokens` |
This file contains hidden or 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
Get the Heroku db as detailed here: | |
http://devcenter.heroku.com/articles/pgbackups#exporting_via_a_backup | |
1. heroku pgbackups:capture | |
2. heroku pgbackups:url <backup_num> #=>backup_url | |
- get backup_num with cmd "heroku pgbackups" | |
3. curl -o latest.dump <backup_url> | |
Then locally do: | |
$ pg_restore --verbose --clean --no-acl --no-owner -h localhost -U myuser -d mydb latest.dump |
This file contains hidden or 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
Tested on: Rails 3.1 | |
In this example, you want to return as json a group of Items and the name of the Company which makes them. | |
Models are as follows: | |
class Company < ActiveRecord::Base | |
has_many :items | |
class Item < ActiveRecord::Base |
This file contains hidden or 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
version: grunt-cli v0.1.8 | |
1. Install node-inspector globally (-g) | |
npm install -g node-inspector | |
2. Add debugger statements to your code | |
3. Run your grunt task in debug mode |
This file contains hidden or 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
Versions: Datatables 1.8.x | |
If get error such as: | |
DataTables warning (table id = 'myTable'): Requested unknown parameter '2' | |
from the data source for row 0 | |
Means num of columns in table heading and in data as specified in | |
aoColumns do not match. Making sure are same number should fix this. |
This file contains hidden or 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
echo "redoing aliases" | |
# alias to reload aliases in your current window | |
alias real=". ~/kagemusha/aliases/aliases" | |
# specific things i'm currently working on | |
alias rspet="rspec spec/controllers/api/canvas/email_templates_controller_spec.rb" | |
alias rspes="rspec spec/controllers/api/canvas/email_sections_controller_spec.rb" | |
alias dlvw="dlv debug github.com/kagemusha/vowpal_websrv -- --workers 1 --models ./sample_models" | |
alias 58="lsof -i tcp:5858" |
This file contains hidden or 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
Version: Rails 3.2.1 | |
TypeError: Cannot visit Videoset | |
Happens when specify class for id in validations (perhaps other places), e.g.: | |
INCORRECT | |
validates_uniqueness_of :song_num, :scope=>[:videoset] | |
CORRECT | |
validates_uniqueness_of :song_num, :scope=>[:videoset_id] |
This file contains hidden or 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
// id SERIAL primary key | |
CREATE TABLE public.user_events | |
( | |
id serial primary key, | |
campaign_id bigint NOT NULL, | |
user_uuid bigint NOT NULL, | |
reward integer NOT NULL | |
) |
This file contains hidden or 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
Tested on: Rails 3.1 | |
If have error: | |
ActionDispatch::Session::SessionRestoreError (Session contains objects whose class definition isn't available. | |
Remember to require the classes for all objects kept in the session. | |
can fix by changing a char in secret token in initializers/secret_token.rb | |
MyApp::Application.config.secret_token |
This file contains hidden or 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
Tested on: Rails 3.1, Mongoid 2.0.1, pg 0.12.0 gem | |
Migrate from Mongo to PG | |
1. remove mongoid gem | |
2. add pg gem | |
3. in application.rb re-add ActiveRecord | |
4. for all models | |
- inherit from ActiveRecord::Base | |
- get rid of Mongoid:Document line | |
- make migrations and put fields there |
NewerOlder