Skip to content

Instantly share code, notes, and snippets.

@chrisbodhi
chrisbodhi / mouseX_ex.java
Created September 29, 2016 04:56
mouseX experiments in Processing
void setup() {
size(640, 360);
}
void draw() {
float transitionVal = float(mouseX) / width * 255;
// dragging the mouse from left to right changes the background color from white to black
background(255 - transitionVal);
rectMode(CENTER);
@chrisbodhi
chrisbodhi / two.java
Created September 29, 2016 04:53
The number two, as a Processing shape
PShape two;
void setup() {
size(640, 360);
smooth(8);
two = createShape();
two.beginShape();
two.strokeWeight(2);
two.noFill();
@chrisbodhi
chrisbodhi / copy.rb
Created September 21, 2016 14:25
Copy from IRB/Pry to the system clipboard
# https://coderwall.com/p/qp2aha/ruby-pbcopy-and-pbpaste
def pbcopy(input)
str = input.to_s
IO.popen('pbcopy', 'w') { |f| f << str }
str
end
(defn factorial
"Returns the factorial of the supplied number"
[n]
(reduce * (into [] (range 1 (inc n)))))
(factorial 5)
; => 120
@chrisbodhi
chrisbodhi / dev.md
Last active July 25, 2016 14:48
Dev Env Setup

#Dev Env Setup

###Starting with the command line

  1. Fire up your Terminal
  2. After you verify that Ruby is installed [ruby -v], install Homebrew by running ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" in your terminal
  3. To use Brew to install your desktop applications [Slack, Sublime Text, &c.], run brew install caskroom/cask/brew-cask
    • [optional] brew cask install iterm2 and hop over to iTerm2
    • [optional] Install oh-my-zsh by running sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" and follow the configuration instructions
  4. Install node.js & npm using the instructions found here to avoid global package & sudo nonsense
@chrisbodhi
chrisbodhi / factorial.rb
Created July 15, 2016 03:08
"Recursion is the GOTO of functional programming." -- Erik Meijer
def factorial n
(1..n).reduce{ |x, y| x * y }
end
@chrisbodhi
chrisbodhi / factorial.py
Last active September 13, 2021 19:20
"Recursion is the GOTO of functional programming." -- Erik Meijer
# "Recursion is the GOTO of functional programming." -- Erik Meijer
def fact(n):
return reduce(lambda x, y: x * y, range(1, n + 1))
print(fact(5))
# => 120
@chrisbodhi
chrisbodhi / deep_work.md
Last active June 8, 2024 11:52
A summary of the tips & tricks in Cal Newport's "Deep Work"

Deep Work

Rules for Focused Success in a Distracted World

Cal Newport, 2016 [purchase it at half-price books]

Part I: The Idea

  • Deep Work is valuable
  • Deep Work is rare
  • Deep Work is meaningful
@chrisbodhi
chrisbodhi / newMachine.md
Last active July 25, 2016 12:47
Links to articles and gists for configuring a new environment
@chrisbodhi
chrisbodhi / Preferences.sublime-settings
Last active July 25, 2016 12:42
Sublime Text 3 User Preferences
{
"bold_folder_labels": true,
"caret_style": "phase",
"color_scheme": "Packages/Solarized Color Scheme/Solarized (light).tmTheme",
"fade_fold_buttons": false,
"highlight_line": true,
"highlight_modified_tabs": true,
"hot_exit": true,
"ignored_packages":
[