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
jared@Jareds-MacBook ~/code/js$ cd relay/examples/todo && npm install | |
> babel-relay-plugin@0.4.2 prepublish /Users/jared/code/js/relay/scripts/babel-relay-plugin | |
> npm run build | |
> babel-relay-plugin@0.4.2 build /Users/jared/code/js/relay/scripts/babel-relay-plugin | |
> scripts/build-lib | |
module.js:339 |
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 'benchmark' | |
Benchmark.bm(30) do |x| | |
x.report("Test One") do | |
# .. code for your first version here .. | |
end | |
x.report("Test Two") do | |
# .. code for your second version here .. | |
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
hash = { ... some stuff ... } | |
keys = hash.keys | |
random_key = keys[(rand(keys.count)] | |
hash[random_key] |
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 percent_asset_split | |
plan.best_investment(risk_index).map do |symbol, percentage| | |
::Position.new(:symbol => symbol.to_s, :amount => percentage.to_f, :account => self.account).asset_allocation | |
end.sum.compress.to_percent | |
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
/* Here's what you've got */ | |
/* | |
Problem 2: You are asked to implement an automated number-to-language translation system for a phone com- pany. Write a C program that receives as an input an integer number and converts each digit of the number to an English word. The integer number can be of any length. | |
Sample program execution: | |
Please enter your phone number: 2345769854 two three four five seven six nine eight five four | |
*/ |
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
module MethodDeprecator | |
def self.included(base) | |
base.extend(ClassMethods) | |
end | |
module ClassMethods | |
def deprecate_method(method, replacement) | |
class_eval <<-DEPRECATE_METHOD_END | |
def #{method.to_s}_with_deprecation | |
puts "WARNING: Deprecated method #{self.class}##{method.to_s} called, use #{replacement} instead. Called from #{Kernel.caller[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
$ valgrind --leak-check=yes ./php ~/code/php/ext/rust_a_star/src/rust_a_star.php | |
==15950== Memcheck, a memory error detector | |
==15950== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. | |
==15950== Using Valgrind-3.11.0.SVN and LibVEX; rerun with -h for copyright info | |
==15950== Command: ./php /Users/jmcfarland/code/php/ext/rust_a_star/src/rust_a_star.php | |
==15950== | |
--15950-- ./php: | |
--15950-- dSYM directory is missing; consider using --dsymutil=yes | |
--15950-- UNKNOWN host message [id 412, to mach_host_self(), reply 0x30f] | |
--15950-- UNKNOWN host message [id 222, to mach_host_self(), reply 0x30f] |
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
$ cpp -I. -I/Users/jmcfarland/code/php/ext/rust_fib -DPHP_ATOM_INC -I/Users/jmcfarland/code/php/ext/rust_fib/include -I/Users/jmcfarland/code/php/ext/rust_fib/main -I/Users/jmcfarland/code/php/ext/rust_fib -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 rust_fib.c | |
#### OUTPUT | |
# 1 "rust_fib.c" | |
# 1 "<built-in>" 1 | |
# 1 "<built-in>" 3 | |
# 169 "<built-in>" 3 | |
# 1 "<command line>" 1 | |
# 1 "<built-in>" 2 |
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
#![feature(core)] | |
extern crate rand; | |
extern crate core; | |
use std::sync::{Arc, Mutex}; | |
use std::thread; | |
use std::fmt::{Display, Formatter, Result}; | |
use core::ops::Deref; |
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
src/game.rs:110:32: 110:61 error: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements | |
src/game.rs:110 self.game_state.render(&mut self.rendering_component, &mut self.maps, &mut self.windows); | |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
src/game.rs:110:32: 110:61 note: first, the lifetime cannot outlive the expression at 110:31... | |
src/game.rs:110 self.game_state.render(&mut self.rendering_component, &mut self.maps, &mut self.windows); | |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
src/game.rs:110:32: 110:61 note: ...so that reference is valid at the time of borrow | |
src/game.rs:110 self.game_state.render(&mut self.rendering_component, &mut self.maps, &mut self.windows); | |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
src/game.rs:110:9: 110:97 note: but, the lifetime must be valid for the method call at 110:8... |
NewerOlder