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 test_case_missing_slash.rb | |
Run options: --seed 62773 | |
# Running: | |
D, [2014-09-25T10:40:05.782387 #7511] DEBUG -- : | |
D, [2014-09-25T10:40:05.782441 #7511] DEBUG -- : | |
I, [2014-09-25T10:40:05.782843 #7511] INFO -- : Started GET "/test" for 127.0.0.1 at 2014-09-25 10:40:05 -0700 | |
F, [2014-09-25T10:40:05.783768 #7511] FATAL -- : | |
RuntimeError (Could not find root path for #<TestEngine1::Engine:0x007f3beee14110>): |
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(@patient) do |f| %> | |
<% if @patient.errors.any? %> | |
<div id="error_explanation"> | |
<h2><%= pluralize(@patient.errors.count, "error") %> prohibited this patient from being saved:</h2> | |
<ul> | |
<% @patient.errors.full_messages.each do |message| %> | |
<li><%= message %></li> | |
<% end %> | |
</ul> |
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_block "create services" do | |
block do | |
service_res = Chef::Resource::Service.new service_name, run_context | |
service_res.provider Chef::Provider::Service::Upstart | |
service_res.supports status: true, restart: true, reload: true | |
service_res.subscribes :restart, "deploy_revision[#{service_name}]", :delayed | |
service_res.run_action :enable | |
end | |
action :run | |
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 com.mygdx.game; | |
import com.badlogic.gdx.ApplicationAdapter; | |
import com.badlogic.gdx.Gdx; | |
import com.badlogic.gdx.graphics.GL20; | |
import com.badlogic.gdx.graphics.OrthographicCamera; | |
import com.badlogic.gdx.graphics.Texture; | |
import com.badlogic.gdx.graphics.g2d.*; | |
import com.badlogic.gdx.maps.MapLayers; | |
import com.badlogic.gdx.maps.tiled.TiledMap; |
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 myObject = { | |
property1: 'test', | |
myFunc: function(arg) { | |
// the 'this' object refers to the instance of the myObject variable | |
this.property1 = arg; | |
alert("Does this === myObject ? " + (this === myObject ? "yes" : "no") ); | |
var a = function() { | |
// inside a closure the 'this' object is now === window | |
alert("Does this === window ? " + (this === window ? "yes" : "no")); |
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
from twisted.internet import reactor, defer | |
class Api: | |
def __init__(self): | |
self.domainObjects = None | |
self.subscribers = [] | |
def test(self, url): | |
# code for doing the async 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
/* | |
Assuming you have JSON POSTed to your action in the form: | |
{ "id": 1, "name": "John Smith", "description": "Some description here" } | |
*/ | |
// class for the POSTed data | |
[Serializable] | |
public class SomeJsonModelFormData |
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
Day job: | |
Software Developer by day...and night | |
Favorite Python project: | |
Twisted | |
Favorite Conference: | |
Haven't been to any *sad trombone* | |
Python Experience Level: |
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 static class HtmlHelperExtensions | |
{ | |
public static string ControllerName<TController>(this HtmlHelper helper) where TController : Controller | |
{ | |
return typeof(TController).Name.Replace("Controller", string.Empty); | |
} | |
} |
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 orders = new [] { 1, 5, 7, 42 }; | |
var customers = new [] { 1, 2, 3, 4, 5, 6, 7, 42 }; | |
var customersWithOrdersCount = 0; | |
foreach (var c in customers) { | |
foreach (var o in orders) { | |
if (c == o) { | |
customersWithOrdersCount++; |
OlderNewer