Class names are CamelCase
.
Methods and variables are snake_case
.
Methods with a ?
suffix will return a boolean.
$('#collection').append("<%= j render partial: 'partial', collection: @collection %>"); | |
<% if @collection.next_page %> | |
$('.pagination').replaceWith('<%= j will_paginate(@collection) %>'); | |
<% else %> | |
$('.pagination').remove(); | |
<% end %> |
client = ElasticWrapper::Session.new.client | |
client.search(index: 'test', type: 'contacts', body: body) | |
body = { query: { bool: { filter: { term: { name: 'lachlan' } } } } } | |
=> | |
[{ | |
"_index"=>"test", | |
"_type"=>"contact", | |
"_id"=>"1", |
{ | |
"template": "account-*", | |
"settings": { | |
"analysis": { | |
"analyzer": { | |
"default": { | |
"tokenizer": "keyword", | |
"filter": "lowercase" | |
} | |
} |
cmd + option + (1,2,3,4,5)
for split sublime into panes
cmd + shift + p
to open sublime command palette
cmd + c
with nothing selected in sublime copies the entire line for pasting
cmd + x
with nothing selected in sublime cuts the entire line for pasting
ctrl + cmd + (up,down)
to move entire line up or down
namespace :missing_tests do | |
def progress(name, x, y) | |
print "\r #{name}: #{x}/#{y} %6.2f%%" % [x.to_f / y * 100] | |
end | |
def generate_files(name) | |
kind = name.to_s.singularize | |
collection = Dir.glob Rails.root.join('app', name.to_s, '**', '*').to_s | |
root = Rails.root.join('app', name.to_s).to_s << '/' | |
ext = case name |
I was attempting to generate a list of links and found that some of them needed query params and others didn't. I could not find a recommended way to pass in a dynamic query-params object to the link-to helper. I ended up finding a solution in the Ember Discourse and decided to make it into an ember helper.
Helper:
import Ember from 'ember';
export function dynamicParams([routeName, params]/*, hash*/) {
return [
# git-auto-rebase | |
# git-auto-rebase --force-push | |
function git-auto-rebase() { | |
target="master" | |
if [[ $@ = "--force-push" ]] | |
then | |
push=true | |
else | |
push=false |