This file contains hidden or 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
| #include <stdio.h> | |
| int main(int argc, char* argv[]) { | |
| int a = 1; | |
| a++; | |
| printf("%d\n", a); | |
| } | |
| # => 2 |
This file contains hidden or 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
| render json: Resource.where(something: params[:something]).first_or_create do |r| | |
| r.enabled = params[:enabled] | |
| r.foo = params[:foo] | |
| r.bar = params[:bar] | |
| end |
This file contains hidden or 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 "ostruct" | |
| class Bar | |
| attr_reader :num | |
| def initialize(num) | |
| @num = num | |
| end | |
| def zoo |
This file contains hidden or 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 | |
| def create_module(representation, &block) | |
| parts = representation.split("::") | |
| (0...parts.size).each do |idx| | |
| const = parts[(0..idx)].join("::") | |
| eval "::#{const} = Module.new unless defined?(::#{const})" | |
| end | |
| if block_given? |
This file contains hidden or 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 | |
| $api_key = ""; | |
| $subdomain = ""; | |
| $handle = curl_init('https://'.$subdomain.'.chargify.com/customers/100000.json'); | |
| curl_setopt($handle, CURLOPT_USERPWD, $api_key . ":x"); | |
| curl_setopt($handle, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); | |
| curl_setopt($handle, CURLOPT_RETURNTRANSFER, true); | |
| $response = curl_exec($handle); |
This file contains hidden or 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 Wombat do | |
| context "with an active user" do | |
| let(:active_user) do | |
| user = User.new | |
| user.tap(&:make_active) | |
| end | |
| it "is a cuddly creator" do | |
| expect(Wombat.new(active_user)).to be_cuddly | |
| end |
This file contains hidden or 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 Wombat do | |
| let(:active_user) do | |
| user = User.new | |
| user.tap(&:make_active) | |
| end | |
| context "with an active user" do | |
| it "is a cuddly creator" do | |
| expect(Wombat.new(active_user)).to be_cuddly | |
| end |
This file contains hidden or 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 "spec_helper" | |
| describe FuManchu do | |
| let(:something_expensive) { Record.new.tap(&:save) } | |
| let(:something_inexpensive) { OpenStruct.new(cheap: true) } | |
| context "a stash" do | |
| it "uses the something expensive" do |
This file contains hidden or 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 "spec_helper" | |
| # I would like to.. | |
| describe "a story." do | |
| # there once was a chicken | |
| it "was a lovely chicken" do | |
| # you could always | |
| expect(the_chicken).to cluck | |
| end |
This file contains hidden or 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 "minitest/autorun" | |
| class ALongTest < Minitest::Test | |
| def setup | |
| @this_is_cool = true | |
| end | |
| def test_this_is_cool | |
| assert @this_is_cool |