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
sudo apt-get update | |
sudo apt-get install git-core zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev | |
cd | |
git clone https://github.com/excid3/asdf.git ~/.asdf | |
echo '. "$HOME/.asdf/asdf.sh"' >> ~/.bashrc | |
echo '. "$HOME/.asdf/completions/asdf.bash"' >> ~/.bashrc | |
echo 'legacy_version_file = yes' >> ~/.asdfrc | |
echo 'export EDITOR="code --wait"' >> ~/.bashrc |
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
## Options section | |
setopt correct # Auto correct mistakes | |
setopt extendedglob # Extended globbing. Allows using regular expressions with * | |
setopt nocaseglob # Case insensitive globbing | |
setopt rcexpandparam # Array expension with parameters | |
setopt nocheckjobs # Don't warn about running processes when exiting | |
setopt numericglobsort # Sort filenames numerically when it makes sense | |
setopt nobeep # No beep | |
setopt appendhistory # Immediately append history instead of overwriting | |
setopt histignorealldups # If a new command is a duplicate, remove the older one |
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
#routes | |
constraints(AffiliateSubdomain) do | |
match '/', to: 'affiliates/properties#index', via: :all | |
end | |
#libs/affiliate_subdomain.rb | |
class AffiliateSubdomain | |
def self.matches? request | |
matching_site?(request) |
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 arrayify(string) | |
if string.class == Array | |
string.to_a.map{ |v1| | |
if v1.class == Array | |
v1.map{ |v2| | |
if v2.class == Symbol | |
v2 | |
elsif v2.class == Array | |
v2.map{|k| | |
if k.class == Hash |
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
class SimpleLinearRegression | |
def initialize(xs, ys) | |
@xs, @ys = xs, ys | |
if @xs.length != @ys.length | |
raise "Unbalanced data. xs need to be same length as ys" | |
end | |
end | |
def y_intercept | |
mean(@ys) - (slope * mean(@xs)) |
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 'date' | |
# Actually doesn't matter WHAT you choose as the epoch, it | |
# won't change the algorithm. Just don't change it after you | |
# have cached computed scores. Choose something before your first | |
# post to avoid annoying negative numbers. Choose something close | |
# to your first post to keep the numbers smaller. This is, I think, | |
# reddit's own epoch. | |
$our_epoch = Time.local(2005, 12, 8, 7, 46, 43).to_time |
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
// a noobs no good very bad javascript... | |
$(function() { | |
$('#membershipsTable').DataTable({ | |
'order': [[1, 'asc']], | |
'columnDefs': [{ | |
'targets': [3], | |
'orderable': false | |
}], | |
}); |
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
void loop() { | |
int tSignal_status = digitalRead(tSignal); | |
if (tSignal_status == 1) { | |
status = 1; | |
prev_status = 1; | |
} | |
if (tSignal_status == 0) { |
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 'sinatra' | |
require 'sinatra/activerecord' | |
require './config/environments' | |
require './models/flick' | |
require 'pi_piper' | |
include PiPiper | |
set :bind, '192.168.1.75' | |
set :port, '5678' |
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
# Function to print strftime results | |
def print_strftime_formats(a,cur_date) | |
a.each do |format| | |
b = "%#{format}" | |
output = cur_date.strftime(b) | |
puts "t.strftime('#{b}'), => #{output}" | |
end | |
end | |
a = ('a'..'z').to_a |