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
# | |
# run like this: | |
# | |
# > git clone https://gist.github.com/8350277.git reducer | |
# > cd reducer | |
# > gem install rspec -v 2.14.1 | |
# > rspec reducer.rb | |
# | |
require "rspec" |
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
<?php | |
$url = "https://www.torial.com/groups/dmw/members.json"; | |
$response = file_get_contents($url); | |
$members = json_decode($response); | |
# wir liefern noch mehr daten als in der folge ausgegeben werden, für die vollständige liste folgendes ausgeben: | |
# var_dump($members); | |
foreach ($members as $member) { |
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 'test/unit' | |
require 'mocha/setup' | |
require 'fileutils' | |
class MyClass | |
def do_it | |
file = "/tmp/foo" | |
FileUtils.touch(file) | |
FileUtils.chmod(0777, file) | |
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
I've tried spring with Ruby 1.9.3/p327 (installed via rvm), running Rails 2.3.6. | |
* The server starts up twice (I had killed all instances before): | |
Maybe these are for test and dev env. But I've already seen three server.rb instances so I doubt that. | |
> ps aux|grep spring | |
phillip 17877 13,5 3,1 3164768 131244 s000 S 4:57pm 0:18.12 /Users/phillip/.rvm/rubies/ruby-1.9.3-p327-turbo/bin/ruby -r bundler/setup /Users/phillip/.rvm/gems/ruby-1.9.3-p327-turbo@torial/gems/spring-0.0.2/lib/spring/server.rb | |
phillip 18036 0,0 0,0 2434892 540 s007 R+ 4:59pm 0:00.00 grep --color=auto spring |
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 'transcoder/base' | |
require 'transcoder/video' | |
class Content < ActiveRecord::Base | |
image_accessor :cover_image do | |
after_assign :make_preview_video | |
end | |
image_accessor :preview_video | |
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
IRB.conf[:PROMPT_MODE] = :SIMPLE | |
IRB.conf[:ECHO] = false |
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
[ | |
// goto line | |
{ "keys": ["super+l"], "command": "show_overlay", "args": {"overlay": "goto", "text": ":"} }, | |
// goto method | |
{ "keys": ["super+shift+t"], "command": "show_overlay", "args": {"overlay": "goto", "text": "@"} } | |
] |
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 "#visible_for_user?" do | |
let(:owner) { FactoryGirl.create(:user) } | |
let(:other_user) { FactoryGirl.create(:user) } | |
let(:private_content) { FactoryGirl.build(:private_content, :project => owner.default_project) } | |
let(:public_content) { FactoryGirl.build(:public_content, :project => owner.default_project) } | |
specify { private_content.should be_visible_for_user(owner) } | |
specify { private_content.should_not be_visible_for_user(other_user) } | |
specify { public_content.should be_visible_for_user(owner) } | |
specify { public_content.should be_visible_for_user(other_user) } | |
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
# loop do | |
# start = Time.now | |
# `curl -s http://staging.torial.com` | |
# puts "Requested in #{Time.now - start}s" | |
# end | |
[...] | |
Requested in 0.148879s | |
Requested in 0.137547s | |
Requested in 0.165125s |
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
### Gemfile | |
group :test do | |
gem "rspec" | |
gem "capybara" | |
# ... | |
end | |
### spec_helper.rb |