Skip to content

Instantly share code, notes, and snippets.

View kagemusha's full-sized avatar

Michael kagemusha

View GitHub Profile
@kagemusha
kagemusha / gist:b7f57be9becb4a054d780d8c95af22bc
Last active November 10, 2018 19:00
sample osx/linux aliases
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"
@kagemusha
kagemusha / gist:b97db366ccec0fe11995c77755319295
Created June 19, 2018 17:08
Create postgres table with auto-incrementing primary key
// 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
)
@kagemusha
kagemusha / go get with private github repo
Created June 13, 2018 16:28
go get with private github repo
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`
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@kagemusha
kagemusha / gist:8b95b93cfac710c7dd387f750432d1ed
Last active April 2, 2016 15:48
Updating an association with Elixir Ecto
defmodule PhoenixTimeline.Game do
...
schema "games" do
belongs_to :winner, PhoenixTimeline.Player
has_many :players, PhoenixTimeline.Player
...
end
...
end
@kagemusha
kagemusha / gist:8626265
Created January 26, 2014 00:54
Rails Cors
1. install rack-cors gem (https://github.com/cyu/rack-cors)
gem 'rack-cors', :require => 'rack/cors'
2. add to application.rb
config.middleware.insert_before "Rack::Lock", "Rack::Cors", :debug => true, :logger => Rails.logger do
allow do
origins '*'
@kagemusha
kagemusha / gist:6783059
Created October 1, 2013 18:40
Ember Data Store Synchronous Methods - not a complete list
store.getById
sync return rec from store if avail or return null
e.g.
var post = store.getById('post', 1);
filter: function(type, query, filter)
@param {Class} type
@param {Function} filter
@kagemusha
kagemusha / gist:6769178
Created September 30, 2013 19:50
Ember linkTo => link-to (c. Em.v1.0 9/26/2013)
In general:
1. somepropBinding=val => someprop=val
2. except for classNameBindings
e.g. classNameBindings=":option isSelected:selected"
for example:
{{#linkTo
option.path
typeBinding=option.value
@kagemusha
kagemusha / gist:6716491
Created September 26, 2013 16:18
Query Params in Ember
https://github.com/emberjs/ember.js/pull/3182
@kagemusha
kagemusha / gist:5866759
Created June 26, 2013 11:37
Using Debugger with Grunt
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