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
| #coding:utf-8 | |
| def fuga(n, i, n_max) | |
| kugiru = 2 ** (i+1) | |
| tonari = 2 ** i | |
| if(n % kugiru < kugiru/2) | |
| n + tonari | |
| else | |
| n - tonari |
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
| run 'echo "" > Gemfile' | |
| add_source 'https://rubygems.org' | |
| gem 'rails', '3.2.13' | |
| gem_group :development, :test do | |
| gem 'sqlite3', '1.3.5' | |
| gem 'rspec-rails', '2.11.0' | |
| 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 "spring/watcher/abstract" | |
| require "spring/watcher/listen" | |
| require "spring/watcher/polling" | |
| module Spring | |
| class << self | |
| attr_accessor :watch_interval | |
| attr_writer :watcher | |
| 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
| task :default => :convert | |
| desc "convert qwik to markdown (using pbcopy/pbpaste for osx)" | |
| task :convert do | |
| file = IO.popen('pbpaste', 'r+') | |
| str = file.map do |s| | |
| s.gsub!(/^(\*+)/){ '#' * $1.length } | |
| s.gsub!(/^(-++)/){ ' ' * ($1.length - 1) + '-' } | |
| s.gsub!(/\[\[(.*?)\|(.*?)\]\]/){ "[#{$1}](#{$2})" } | |
| s |
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
| def sign_in(user) | |
| case example.metadata[:type] | |
| when :controller, :request | |
| cookies[:remember_token] = user.remember_token | |
| when :feature | |
| visit signin_path | |
| fill_in "Email", with: user.email.upcase | |
| fill_in "Password", with: user.password | |
| click_button "Sign in" | |
| else |
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
| #coding:utf-8 | |
| require 'fileutils' | |
| task :default => :create_todays_report | |
| desc "create today's almost daily report" | |
| task :create_todays_report do | |
| report = Report.new | |
| report.create_dir | |
| report.create_file |
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
| gem 'haml-rails' | |
| gem 'omniauth' | |
| gem_group :development, :test do | |
| gem 'rspec-rails' | |
| gem 'factory_girl_rails' | |
| gem 'guard-rspec' | |
| gem 'database_cleaner' | |
| gem 'erb2haml' | |
| 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_gcc | |
| install_package "yaml-0.1.4" "http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz#36c852831d02cf90508c29852361d01b" | |
| install_package "ruby-1.9.2-p136" "http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p136.tar.gz#6e17b200b907244478582b7d06cd512e" | |
| install_package "rubygems-1.8.23" "http://production.cf.rubygems.org/rubygems/rubygems-1.8.23.tgz#178b0ebae78dbb46963c51ad29bb6bd9" ruby |
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
| | Left align | Right align | Center align | | |
| |:-----------|------------:|:------------:| | |
| | This | This | This | | |
| | column | column | column | | |
| | will | will | will | | |
| | be | be | be | | |
| | left | right | center | | |
| | aligned | aligned | aligned | |
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
| greet :: String -> String | |
| greet name | |
| | name == "Juan" = niceGreeting ++ " " ++ name | |
| | otherwise = badGreeting ++ " " ++ name | |
| where niceGreeting = "Hello! So very nice to see you," | |
| badGreeting = "Oh! Pfft. It's you." | |
| greet' :: String -> String | |
| greet' "Juan" = niceGreeting ++ " " ++ "Juan" | |
| where niceGreeting = "Hello! So very nice to see you," |
OlderNewer