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
ls | xargs -P2 -I% echo "This file is [%]" | |
# -I replstr |
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
################################################################ | |
# For views/migrations etc. check http://tinyurl.com/3xfx3zm # | |
################################################################ | |
# File : RAILS_APP/config/initializers/devise.rb | |
# Change the following only. Rest can stay same | |
# NOTE : You must use devise master or any version released after Mar 13, 2011 to get everything mentioned here working. | |
config.authentication_keys = [ :login ] | |
config.confirmation_keys = [ :login ] | |
config.unlock_keys = [ :login ] |
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
# To play with routes in the rails console from rails 3.1, use the following: | |
include Rails.application.routes.url_helpers | |
default_url_options[:host] = 'localhost:3000' # or whatever | |
# Now, can freely play with routes. | |
>> url_for User.first | |
=> "http://localhost:3000/users/7" | |
>> url_for [Pod.first, :tasks] | |
=> "http://localhost:3000/pods/8/tasks" | |
# etc. |
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
git log -S 'command :cp' |
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
export PACKAGESITE=http://ubalo.io.s3.amazonaws.com/packages/public | |
sudo pkg update | |
sudo pkg info -e java/openjdk6 || sudo pkg install -y java/openjdk6 | |
javac hello.java |
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
SERVER = 'imap.gmail.com' | |
USERNAME = 'XXX' | |
PW = 'XXX' | |
require 'net/imap' | |
require 'net/smtp' | |
require 'tmail' | |
require 'maruku' | |
def to_markdown(text) | |
Maruku.new(text).to_html |
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
.hll { background-color: #ffffcc } | |
.c { color: #408080; font-style: italic } /* Comment */ | |
.err { border: 1px solid #FF0000 } /* Error */ | |
.k { color: #008000; font-weight: bold } /* Keyword */ | |
.o { color: #666666 } /* Operator */ | |
.cm { color: #408080; font-style: italic } /* Comment.Multiline */ | |
.cp { color: #BC7A00 } /* Comment.Preproc */ | |
.c1 { color: #408080; font-style: italic } /* Comment.Single */ | |
.cs { color: #408080; font-style: italic } /* Comment.Special */ | |
.gd { color: #A00000 } /* Generic.Deleted */ |
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
data = ubalo.recv() | |
ubalo.map("analyze", data) | |
ubalo.send(final_result) |
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 'rest-client' | |
require 'json' | |
site = "https://api.mmx.io" | |
path = "/query/summary" | |
token = $TOKEN # be sure to set this in your command line environment. | |
url = "https://api.mmx.io/query/summary" | |
body = { | |
datasource: "demoexchange", |
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
# | |
# Lunar/Moon phases ruby class | |
# | |
# Code is based upon Bradley E. Schaefer''s moon phase algorithm. | |
# Ruby version based on JavaScript Phase Calculator by Stephen R. Schmitt | |
class Moon | |
attr_reader :epoch, :phase, :days, :icon, :dist, :ll, :emoji | |
# Return the current (or input a date) moon. | |
# Moon.new |