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
| 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 }} |
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
| url: http://localhost:3000/signin from: https://localhost:3001/signin | |
| $.ajax( | |
| type: "POST" | |
| url: url | |
| data: | |
| user: | |
| password: password | |
| login: email | |
| contentType: 'text/plain' |
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
| A = Backbone.Collection.extend( | |
| sync: (method, collection, option) -> | |
| return Backbone.sync(...) | |
| ) | |
| B = A.extend( | |
| #sync: (method, collection, option) -> |
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
| require.config shim: | |
| underscore: | |
| exports: "_" | |
| backbone: | |
| deps: ["underscore", "jquery"] | |
| exports: "Backbone" | |
| "backbone.layoutmanager": ["backbone"] |
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
| 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" |
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
| 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 |
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
| 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 |
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
| 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 |
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
| #!/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 : |
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
| " 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(".") |