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 <math.h> | |
#include <stdio.h> | |
int main() { | |
double a = 16.99; | |
double b = 100.0; | |
printf("a is %f\n", a); | |
printf("b is %f\n", b); |
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
Error: signal SIGSEGV | |
0 rbx 0x00000001000474af _ZN8rubiniusL12segv_handlerEi + 159 | |
1 libSystem.B.dylib 0x00007fff8026480a _sigtramp + 26 | |
2 ??? 0x0000000000000000 0x0 + 0 | |
3 libMagickCore.2.dylib 0x00000001073189b5 AcquirePixelCache + 325 | |
4 libMagickCore.2.dylib 0x00000001073c3406 AcquireImage + 358 | |
5 libMagickCore.2.dylib 0x00000001073c3af2 SetImageInfo + 466 | |
6 libMagickCore.2.dylib 0x000000010734056d ReadImage + 173 | |
7 RMagick2.bundle 0x000000010719b712 rd_image + 318 |
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
worker_processes 6 | |
preload_app true | |
timeout 180 | |
listen 8100 | |
working_directory "/opt/teachstreet/web-app/current" | |
stderr_path "log/unicorn.log" | |
stdout_path "log/unicorn.log" |
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
set :unicorn_pid, "#{current_path}/tmp/pids/unicorn.pid" | |
namespace :unicorn do | |
desc "start unicorn" | |
task :start, :roles => :app, :except => { :no_release => true } do | |
run "cd #{current_path} && #{try_sudo} bundle exec unicorn_rails -c #{current_path}/config/unicorn-#{rails_env}.rb -E #{rails_env} -D" | |
end | |
desc "stop unicorn" | |
task :stop, :roles => :app, :except => { :no_release => true } do | |
run "#{try_sudo} kill `cat #{unicorn_pid}`" |
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 to_xml(options = {}) | |
options[:indent] ||= 2 | |
xml = options[:builder] ||= Builder::XmlMarkup.new(:indent => options[:indent]) | |
xml.instruct! unless options[:skip_instruct] | |
xml.deal do | |
xmlify = lambda do |key,value| | |
case value | |
when Array | |
xml.tag!(key.to_sym) do | |
value.map{|v| [key.to_s.singularize, v]}.each(&xmlify) |
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($) { | |
// crossfade takes an image list, which is an array of hashes with | |
// src: image url | |
// title: link title | |
// href: link url | |
// | |
// available options: | |
// fadeTime: time in msec of how long cross fade transition takes | |
// waitTime: time in msec of how long to wait between transitions | |
// imageHeight: height of each image |
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
Number.prototype.plural = function(){ | |
if(this > 1 || this == 0){ | |
return true; | |
} else { | |
return false; | |
} | |
} | |
String.prototype.pluralize_rules = function(){ | |
return [[new RegExp('$', 'gi'), 's']]; |
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
" map ,r to run contents in repl | |
map ,r :w\|:silent !cat % > repl-command<cr>:redraw!<cr> | |
" map ,r in visual mode to run contents in repl | |
vmap ,r :w !cat > repl-command<cr>:redraw!<cr> | |
" map ,l to map current line in repl | |
map ,l :silent.w !cat > repl-command<cr>:redraw!<cr> |
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 ApplicationController < ActionController::Base | |
protect_from_forgery | |
before_filter :log_params | |
private | |
def log_params | |
logger.debug "*********** Session Data ***********" | |
session.each do |k,v| |
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
Foo::Application.routes.draw do | |
constraints(:host => /^example.com/) do | |
root :to => redirect("http://www.example.com") | |
match '/*path', :to => redirect {|params| "http://www.example.com/#{params[:path]}"} | |
end | |
end |
OlderNewer