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
[ | |
{ | |
"token": "nhMbMTpjMRM1zxNMQzw3g8cwiuOM9D12kQ0MDMvUGdlJ", | |
"mail_address": "[email protected]", | |
"port_not_allowed": true, | |
"hole": false, | |
"warning": true, | |
"info": true, | |
"difference": false, | |
"no_problem": true, |
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 Poldo | |
cattr_accessor :sausages | |
def self.all | |
@sausages ||= SausageFetcher.fetch! | |
end | |
def self.reload! | |
@sausages = SausageFetcher.fetch! | |
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 AcronymSolver | |
attr_reader :text | |
def initialize(text) | |
@text = text | |
end | |
def self.substitutions | |
{ | |
:PPC => 'Pocket PC', |
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 Wordmove::SqlMover do | |
context ".serialized_replace!" do | |
let(:content) { 'a:3:{i:0;s:20:"http://dump.com/spam";i:1;s:6:"foobar";i:2;s:22:"http://dump.com/foobar";}' } | |
let(:sql) { Tempfile.new('sql').tap do |d| d.write(content); d.close end } | |
let(:sql_path) { sql.path } | |
it "should replace source vhost with dest vhost" do | |
sql_mover.serialized_replace!('http://dump.com', 'http://shrubbery.com') | |
sql_mover.sql_content.should == 'a:3:{i:0;s:25:"http://shrubbery.com/spam";i:1;s:6:"foobar";i:2;s:27:"http://shrubbery.com/foobar";}' |
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 serialized_replace!(source_field, dest_field) | |
length_delta = source_field.length - dest_field.length | |
sql_content.gsub!(/s:(\d+):([\\'"]+)(.*?)\2;/) do |match| | |
length = $1.to_i | |
delimiter = $2 | |
string = $3 | |
string.gsub!(/#{Regexp.escape(source_field)}/) do |match| | |
length -= length_delta |
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
void measureSort(const char *name, void (*sortFunction)(int *, int)) { | |
clock_t start,end; | |
double period; | |
int array[MAX]; | |
initRand(array, MAX); | |
start = get_clock(); | |
(*sortFunction)(array, MAX); | |
end = get_clock(); |
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
#include "../apue.h" | |
#include "sys/utsname.h" | |
int | |
main(void) | |
{ | |
struct utsname *ptr; | |
if (uname(ptr) < 0) | |
err_sys("uname failed"); |
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
#include "../apue.h" | |
#include <time.h> | |
#define BUFSIZE 256 | |
int | |
main(void) | |
{ | |
char result[BUFSIZE]; | |
time_t now; |
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
#include "../apue.h" | |
static void | |
my_alrm(int signo) | |
{ | |
/* void */ | |
} | |
unsigned int | |
my_sleep(unsigned int nsecs) |
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 "spec_helper" | |
describe Customer do | |
subject(:customer) { Customer.new('Mario', 'Rossi') } | |
its(:full_name) { should == "Mario Rossi" } | |
context "for a single movie" do | |
let(:rental) { double } | |
before { customer.rent(rental) } |
OlderNewer