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
module Newton | |
module Validator | |
class RepeatsValidator < ActiveModel::EachValidator | |
def initialize(options) | |
@attributes = options[:attributes] | |
super | |
@how_count = options[:how_count] | |
@upto = options[:upto] | |
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
package main; | |
import org.apache.velocity.Template; | |
import org.apache.velocity.VelocityContext; | |
import org.apache.velocity.app.Velocity; | |
import org.apache.velocity.exception.MethodInvocationException; | |
import org.apache.velocity.exception.ParseErrorException; | |
import org.apache.velocity.exception.ResourceNotFoundException; |
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 vote_yes | |
vote(:up_vote) | |
end | |
def vote_no | |
vote(:down_vote) | |
end | |
private |
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
// Most everything left out for clarity. | |
public class RPCRespond<Result> { | |
public RPCRespond() { | |
this.code = 0; | |
this.success = true; | |
this.result = null; | |
} |
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
public class UsesLongRunningCtor { | |
/** Retrieves data and returns processed result. */ | |
public String transformData() { | |
// LongRunningCtor "embedded"; direct reference, like a static utility class. | |
String rawData = LongRunningCtor.instance().fetch(); | |
return rawData.replace("Raw", "Processed"); | |
} | |
} |
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 sublime, sublime_plugin | |
import os | |
class DetectFileTypeCommand(sublime_plugin.EventListener): | |
""" Detects current file type if the file's extension isn't conclusive """ | |
""" Modified for Ruby on Rails and Sublime Text 2 """ | |
""" Original pastie here: http://pastie.org/private/kz8gtts0cjcvkec0d4quqa """ | |
def on_load(self, view): | |
filename = view.file_name() |
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
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org xsd/maven-.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>mygroup</groupId> | |
<artifactId>Test_Maven_03</artifactId> | |
<version>0.0.1-SNAPSHOT</version> | |
<packaging>jar</packaging> | |
<name>Test_Maven_03</name> | |
<url>http://maven.apache.org</url> |
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
customer = { | |
:name => 'Dan Kubb', | |
:orders => [ | |
{ | |
:reference => 'TEST1234', | |
:order_lines => [ | |
{ | |
:item => { | |
:sku => 'BLUEWIDGET1', | |
:unit_price => 1.00, |
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
describe Foo do | |
it { should respond_to(:bar) } | |
end |