Skip to content

Instantly share code, notes, and snippets.

s = Tire.search(SEARCH_INDEX_NAME, :type => 'album', :size => 10) do
query do
boolean do
genres.each do |g|
should { string "genres:#{g}" }
end
end
end
unless already_seen_albums.empty?
filter :not , {:ids => { :values => already_seen_albums }}
url: http://localhost:3000/signin from: https://localhost:3001/signin
$.ajax(
type: "POST"
url: url
data:
user:
password: password
login: email
contentType: 'text/plain'
A = Backbone.Collection.extend(
sync: (method, collection, option) ->
return Backbone.sync(...)
)
B = A.extend(
#sync: (method, collection, option) ->
require.config shim:
underscore:
exports: "_"
backbone:
deps: ["underscore", "jquery"]
exports: "Backbone"
"backbone.layoutmanager": ["backbone"]
define (require) ->
Album = require('modules/models/album')
AlbumView = require('modules/views/albums/album')
describe 'albumview', ->
it 'should render', ->
album = new Album(
id: 1
coverart_small: "Test Album"
album = new Album(
id: 1
coverart_small: "Test Album"
slug: "something_something"
short_name: "Test short name"
artist: "Test Artist"
)
view = new AlbumView(
model: album
class Api::RegistrationsController < Api::BaseController
respond_to :json
def create
user = User.new(params[:user])
if user.save
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201
return
else
SomeModel = Backbone.Model.extend(
)
...
@collection.each((model) ->
console.log model.get('foo') # Returns correctly
bar = new SomeModel(model)
console.log bar.get('foo') # Returns undefined - previously x.get('foo') returned correct too
# So now I have to do
#!/usr/bin/env bash
############
# QuickSBT #
############
# Launch SBT with support for generating /tmp/sbt.quickfix file for Vim
# http://github.com/aloiscochard / https://gist.github.com/4698501
# Error format for SBT, and shortcut to open SBT quickfix file :
" Highlight EOL whitespace, http://vim.wikia.com/wiki/Highlight_unwanted_spaces
highlight ExtraWhitespace ctermbg=darkred guibg=#382424
autocmd ColorScheme * highlight ExtraWhitespace ctermbg=red guibg=red
autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
" the above flashes annoyingly while typing, be calmer in insert mode
autocmd InsertLeave * match ExtraWhitespace /\s\+$/
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
function! s:FixWhitespace(line1,line2)
let l:save_cursor = getpos(".")