This file contains 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
Ruby / Groovy | |
def get_types | |
words.collect{|word| word.word_type} | |
end | |
15 seconds to code. | |
3 seconds to read and understand. | |
Easy to read = self documenting. | |
Less LOC = better codebase and more agile team. |
This file contains 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 'active_support' | |
## strange this isn't done implicitly | |
class A | |
class << self | |
extend ActiveSupport::Memoizable | |
def my_class_method(x) | |
# cool stuff here |
This file contains 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
#!/bin/bash | |
let "RESULT=$(ps ax | grep $1 | wc -l) - 1" ;echo "$RESULT processes found for $1."; if [ "$RESULT" == 0 ]; then exit 0; else exit 1;fi; |
This file contains 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
rm -rf `find . -type d -name .svn` |
This file contains 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 some_method(single_or_array) | |
single_or_array = [*single_or_array] | |
# do awesome stuff here... | |
end |
This file contains 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
$("#e2").select2({ | |
placeholder: "Select a State", | |
allowClear: true | |
}); |
This file contains 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
if (!this.opts.allowClear) { | |
this.container.removeClass("select2-allowclear"); | |
} |
This file contains 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
var deferred = new $.Deferred(); | |
result.fadeTo(2000, 0.4, function() { | |
deferred.resolve(); | |
}); | |
deferred.done( | |
function() {result.addClass('ending'); result.fadeTo(2000, 1.0, function() { | |
deferred = new $.Deferred().resolve(); | |
}); | |
}); |
This file contains 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
@(toggle: String)(enabledContent: Any)(disabledContent: Any) | |
@import play.api._ | |
@defining(Play.current.configuration.getBoolean("toggles." + toggle)) { toggleValue => | |
@toggleValue match { | |
case Some(toggleEnabled) => { | |
@if(toggleEnabled) { |
This file contains 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 sbt.Keys._ | |
import play.Project._ | |
import sbtbuildinfo.Plugin._ | |
import com.gu.SbtJasminePlugin._ | |
object ApplicationBuild extends Build { | |
val appName = "your-app-name" | |
val appVersion = "1.0-SNAPSHOT" |
OlderNewer