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
@Embedded | |
private Log log = new Log(); |
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
<%= form_for parent do |parent_form_builder| %> | |
<%= parent_form_builder.text_field :name %> | |
<% parent.children.each_with_index do |child, index| %> | |
<% parent_form_builder.fields_for :children, child do |child_form_builder| %> | |
<%= child_form_builder.select :age, (0..99).to_a %> | |
<%# generates "parent[:children_attributes][index][age]" as name for the input %> | |
<% end %> | |
<% end %> | |
<%= f.submit %> | |
<% 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
def cte_attr(*attrs) | |
attrs.each do |name| | |
class_eval <<-ATTR | |
def #{name}=(value) | |
@#{name} = value | |
super | |
end | |
ATTR | |
end | |
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
import static javax.ws.rs.core.MediaType.APPLICATION_JSON; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.InputStreamReader; | |
import java.io.OutputStream; | |
import java.io.PrintWriter; | |
import java.lang.annotation.Annotation; | |
import java.lang.reflect.Type; |
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 Q = require("q"); | |
exports.read = function (path, timeout) { | |
var response = Q.defer(); | |
var request = new XMLHttpRequest(); // ActiveX blah blah | |
request.open("GET", path, true); | |
request.onreadystatechange = function () { | |
if (request.readyState === 4) { | |
if (request.status === 200) { |
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
/** @jsx React.DOM */ | |
var ReactDropzone = React.createClass({ | |
componentDidMount: function() { | |
var options = {}; | |
for (var opt in Dropzone.prototype.defaultOptions) { | |
var prop = this.props[opt]; | |
if (prop) { | |
options[opt] = prop; | |
continue; |
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 | |
JERSEY_VERSION=2.5.1 | |
HK2_VERSION=2.2.0-b26 | |
JAVASSIST_VERSION=3.18.1-GA | |
MODULES_DIR=`pwd`/modules | |
OSGI_CACHE_DIR=`pwd`/domains/domain1/osgi-cache/felix | |
processArtifact() { |
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 redis.clients.jedis.Client; | |
import redis.clients.jedis.Jedis; | |
import redis.clients.jedis.Transaction; | |
import org.testng.annotations.*; | |
import static org.mockito.Mockito.*; | |
public class TransactionMockFuckTest { | |
/** | |
* Let's say we want to test the following method |
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
// ------------ | |
// counterStore.js | |
// ------------ | |
import { | |
INCREMENT_COUNTER, | |
DECREMENT_COUNTER | |
} from '../constants/ActionTypes'; | |
const initialState = { counter: 0 }; |
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
app = angular.module 'BlogExample', [] | |
# Simple controller that loads all blog posts | |
app.controller 'BlogCtrl', ['$scope', 'Blog', ($scope, Blog) -> | |
# Get all the blog posts | |
Blog.all().then (posts) -> | |
$scope.posts = posts | |
# Extend the $scope with our own properties, all in one big block | |
# I like this because it looks like declaring a class. |
OlderNewer