Skip to content

Instantly share code, notes, and snippets.

@rosswd
rosswd / blocks.rb
Last active August 29, 2015 13:56
Ruby Blocks
p (1..20).select { |n| n.even? }
# [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]
# => [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]
(1..10).each { |val| p val.to_s }
# "1" "2" "3" "4" "5" "6" "7" "8" "9" "10"
# => 1..10
@rosswd
rosswd / run.c
Last active August 29, 2015 13:56
Compiling and running c and cpp files on gnu linux (trisquel 6.0).
// gcc, the gnu c compiler, should already be installed
// Check it with gcc, a message about 'no input files' means it's already installed
gcc
// create a .c program
vim hello.c
// create the actual program
#include <stdio.h>
@rosswd
rosswd / shortcuts.md
Last active August 29, 2015 14:02
Xcode Workflow
@rosswd
rosswd / footer.php
Last active August 29, 2015 14:05
Wordpress Theme Development
@rosswd
rosswd / spectable.txt
Last active September 1, 2015 19:03
Spectacle keyboard mappings. Support Open Source: https://spectacleapp.com/.
"spectacle mappings"
"Note: this is not a config file you run, you manually set these inside spectable preferences."
default "Description" new
Opt-Cmd-C "Center" Ctrl-Opt-Cmd-C
Opt-Cmd-F "Fullscreen" Ctrl-Opt-Cmd-F
Opt-Cmd-Left "Left Half" Ctrl-Opt-Cmd-Left
Opt-Cmd-Right "Right Half" Ctrl-Opt-Cmd-Right
# Prefer US English and use UTF-8
export LC_ALL="en_US.UTF-8"
export LANG="en_US"
# Custom bash prompt via kirsle.net/wizards/ps1.html
export PS1="\[$(tput bold)\]\[$(tput setaf 7)\]\w \\$ \[$(tput sgr0)\]"
# Tell ls and others to be colorful
export CLICOLOR=1
export LSCOLORS=Exfxcxdxbxegedabagacad
@rosswd
rosswd / hacks.md
Last active October 22, 2015 14:31
HTML, JS, DOM, CSS Hacks
@rosswd
rosswd / chef-solo.rb
Last active December 30, 2015 13:29
Playing with chef.
Vagrant.configure("2") do |config|
config.vm.provision "chef_solo" do |chef|
#chef.cookbooks_path = "../my_recipes/cookbooks"
chef.roles_path = "../my_recipes/roles"
chef.add_role("web")
chef.data_bags_path = "../my_recipes/data_bags"
chef.node_name = "foo"
chef.add_recipe "apache"
chef.add_recipe "apt"
@rosswd
rosswd / 0_reuse_code.js
Created December 15, 2013 22:00
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console