Important things when doing a clean install of Mac OS X
- Contacts
- Calendar
# encoding: utf-8 | |
##################################################################################### | |
# | |
# Fetches info about the people you follow on Twitter | |
# and determines who you could/should unfollow based on: | |
# - activity: was their last update more than 3 months ago? | |
# - popularity: do they have less than 25 followers? | |
# - mass following: are they following more than 10000 people? |
#!/usr/bin/env ruby | |
require "fileutils" | |
require "redcarpet" | |
OUTPUT_FOLDER = "html" | |
HTML_TEMPLATE = <<-HTML | |
<!DOCTYPE html> | |
<html> |
def coupon(parts: 4, chars: 4, separator: "-") | |
SecureRandom.hex(parts*chars/2).upcase.scan(%r/.{#{chars}}/).join(separator) | |
end |
Select all elements in a
that are greater than 5 and multiply them by 2.
Ruby
a.select { |x| x > 5 }.map { |x| x * 2 }
a.find_all { |x| x > 5 }.collect { |x| x * 2 }
a.inject([]) { |b, x| x > 5 ? (b << x * 2) : b }
require "forwardable" | |
module ActiveRecord | |
class Base | |
def save | |
puts "SAVED #{name}" | |
end |
module SnakeCase | |
refine String do | |
def snake_case | |
self.gsub(/::/, '/') | |
.gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2') | |
.gsub(/([a-z\d])([A-Z])/,'\1_\2') | |
.tr("-", "_") | |
.downcase | |
end | |
end |
#!/bin/bash | |
# Install a custom R version, https://www.r-project.org/ | |
# | |
# Add at least the following environment variables to your project configuration | |
# (otherwise the defaults below will be used). | |
# * R_VERSION | |
# | |
# Include in your builds via | |
# source /dev/stdin <<< "$(curl -sSL https://gist.githubusercontent.com/sklppr/cec1b80642e02a12d4e57bc51d803c2e/raw/089ca9b56d6b2364df29db4e78039c3404ce437f/r.sh)" | |
R_VERSION=${R_VERSION:="3.3.0"} |
Most important basic philosophy “simple vs. easy”: Rails Conf 2012 Keynote: Simplicity Matters by Rich Hickey (Slides)
You probably know this already and in Ruby not all of it is done “explicitly” but it’s important to have these principles in mind when getting to know the following architecture concepts.
STUPID: Singleton, Tight Coupling, Untestability, Premature Optimization, Indescriptive Naming, Duplication
SOLID: Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, Dependency Inversion