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
track_branches() { | |
# --- Arguments | |
oldrev=$(git rev-parse $1) | |
newrev=$(git rev-parse $2) | |
refname="$3" | |
case "$refname" in | |
refs/heads/*) | |
branch=$(expr "$refname" : "refs/heads/\(.*\)") | |
featurebranch=$(expr "$branch" : "\(.*/.*\)") |
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
<%= form_tag '/trip', :remote => true, :id => 'searchbox' do -%> | |
<div id="main" > | |
<label>Search</label> | |
<%= text_field_tag :text, @text, :id => 'text' %> | |
</div> | |
</div> | |
<% end -%> |
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
def f(a = "", b = {}, c = "", d = "") | |
puts "a=#{a}" | |
puts "b=#{b}" | |
puts "c=#{c}" | |
puts "d=#{d}" | |
end | |
f(c: "c", d: "d") |
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
source 'https://rubygems.org' | |
gem 'rails', '3.2.3' | |
# Gems used only for assets and not required | |
# in production environments by default. | |
group :assets do | |
gem 'sass-rails', '~> 3.2.3' | |
gem 'coffee-rails', '~> 3.2.1' | |
# See https://github.com/sstephenson/execjs#readme for more supported runtimes |
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 Accommodation < ActiveResource::Base | |
class << self | |
def element_path(id, prefix_options = {}, query_options = nil) | |
prefix_options, query_options = split_options(prefix_options) if query_options.nil? | |
"#{prefix(prefix_options)}#{collection_name}/#{id}#{query_string(query_options)}" | |
end | |
def collection_path(prefix_options = {}, query_options = nil) | |
prefix_options, query_options = split_options(prefix_options) if query_options.nil? | |
"#{prefix(prefix_options)}#{collection_name}#{query_string(query_options)}" |
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
val MaxInt = """(inf)""".r | |
val NormalInt = """(\d*)""".r | |
def parseInt(integerString:String): Int = { | |
integerString match { | |
case MaxInt(_) => Integer.MAX_VALUE | |
case NormalInt(_) => Integer.valueOf(integerString) | |
case _ => throw new NumberFormatException(String.format("Cannot parse %s as an integer", integerString)) | |
} | |
} |
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
<div id="posts"></div> | |
<script type="text/javascript"> | |
$(function() { | |
// Blog is the app name | |
window.router = new Blog.Routers.PostsRouter({posts: <%= @posts.to_json.html_safe -%>}); | |
Backbone.history.start(); | |
}); | |
</script> |
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 Blog.Routers.PostsRouter extends Backbone.Router | |
routes: | |
"posts/:page" : "index" | |
".*" : "index" | |
index: (page) -> | |
pageNumber = page || 1 | |
@posts = new Blog.Collections.PostsCollection() | |
@view = new Blog.Views.Posts.IndexView({model:@posts, page:parseInt(pageNumber)+1}) |
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
import sbt._ | |
import Keys._ | |
import play.Project._ | |
object ApplicationBuild extends Build { | |
val appName = "tweetsearch" | |
val appVersion = "1.0-SNAPSHOT" | |
val appDependencies = Seq( |
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
import com.fasterxml.jackson.databind.{DeserializationFeature, ObjectMapper} | |
import com.fasterxml.jackson.module.scala.experimental.ScalaObjectMapper | |
import com.fasterxml.jackson.module.scala.DefaultScalaModule | |
object JsonUtil { | |
val mapper = new ObjectMapper with ScalaObjectMapper | |
mapper.registerModule(DefaultScalaModule) | |
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) | |
def toJson(value: Map[Symbol, Any]): String = { |