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
> make mistake && ./mistake | |
c++ -Wall -Wextra -std=c++14 -O0 mistake.cpp -o mistake | |
mistake.cpp:8:10: warning: reference to stack memory associated with local variable 's' returned [-Wreturn-stack-address] | |
return s; | |
^ | |
1 warning generated. | |
This is a mista��8 |
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
function trip (s) { | |
if ('tripIntervalId' in window) { | |
clearInterval(window.tripIntervalId); | |
} | |
var filters = ['invert(100%)', 'none'] | |
var counter = 0; | |
function swap() { |
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
[ | |
{ | |
add: {uri: ..., ...} | |
}, | |
{ | |
modify: {uri:..., ...} | |
}, | |
{ | |
delete: {uri: ...} | |
}, |
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
#!/usr/bin/env ruby | |
# | |
# An example hook script to check the commit log message. | |
# Called by "git commit" with one argument, the name of the file | |
# that has the commit message. The hook should exit with non-zero | |
# status after issuing an appropriate message if it wants to stop the | |
# commit. The hook is allowed to edit the commit message file. | |
# | |
commit_msg = File.read(ARGV[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
// Setup | |
var app | |
View.handlerFor = function(view){ | |
new Handler(app, view.models) | |
} | |
View | |
.domEvent('form', 'click', 'submitted', function(e){ return e.clientX; }) |
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
define(['view'], function(View){ | |
return View.sub('ItemView', function(){ | |
this.domEvent('click', 'button', 'selected') | |
}) | |
}) |
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
# Here is a normal set of specs... | |
describe 'some normal rspec' do | |
describe 'doing something with a Product and Users' do | |
before :each do | |
# setup etc | |
# preconditions could go 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
MyApplication::Config = ->(config_path) do | |
if Rails.env.development? | |
require 'rb-fsevent' | |
fsevent = FSEvent.new | |
fsevent.watch config_path do | |
suppress_warnings do | |
MyApplication::Config = Blobject.read(config_path) | |
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
class MyController < ApplicationController | |
def params | |
@blobject_params ||= Blobject.new(super) | |
end | |
def create | |
model = find_model | |
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
# new DSL: | |
# 'act': specifies the action under test as a block | |
# 'result': the return result from 'act' | |
describe MyClass do | |
subject { MyClass.new } | |
describe '#method' do | |
act { subject.method } |