Skip to content

Instantly share code, notes, and snippets.

View rickarubio's full-sized avatar

Ricardo A. Rubio rickarubio

  • Prosper
  • San Francisco, CA
View GitHub Profile
@rickarubio
rickarubio / dbc_logo.png
Last active January 1, 2016 12:19 — forked from dbc-challenges/jquery_example.html
Intro to jQuery for Phase 0
dbc_logo.png
When I call update_attributes on an instance, the database record is updated, but the instance does not have the updated information.
The answer is here:
http://stackoverflow.com/questions/6289531/rails-3-ar-save-and-update-methods-do-not-save-attributes-changed-in-database-b
@rickarubio
rickarubio / Default (OSX).sublime-keymap
Created November 8, 2014 21:35
Unaltered Default OSX Keymap for Sublime Text 3 (I use this to make my linux sublime install match my OSX keybindings)
/*
On OS X, basic text manipulations (left, right, command+left, etc) make use of the system key bindings,
and don't need to be repeated here. Anything listed here will take precedence, however.
*/
[
{ "keys": ["super+shift+n"], "command": "new_window" },
{ "keys": ["super+shift+w"], "command": "close_window" },
{ "keys": ["super+o"], "command": "prompt_open" },
{ "keys": ["super+shift+t"], "command": "reopen_last_file" },
{ "keys": ["super+alt+up"], "command": "switch_file", "args": {"extensions": ["cpp", "cxx", "cc", "c", "hpp", "hxx", "h", "ipp", "inl", "m", "mm"]} },
@rickarubio
rickarubio / notes.md
Last active August 29, 2015 14:16
AnguarJS 2.0 Extended 2/24/15 San Francisco, CA Notes

Intro to Angular 2 Extended

ng-conf coming up at SLC

David East @_DavidEast firebase dev

Motivation for Angular 2

  • Web Standards
  • Shadow DOM replaces transclusion
@rickarubio
rickarubio / nerdtree.vim
Created March 27, 2015 02:48
nerdtree customization taken from janus
let NERDTreeIgnore=['\.pyc$', '\.pyo$', '\.rbc$', '\.rbo$', '\.class$', '\.o$', '\~$']
" Default mapping, <leader>n
call janus#add_mapping('nerdtree', 'map', '<leader>n', ':NERDTreeToggle<CR> :NERDTreeMirror<CR>')
augroup AuNERDTreeCmd
autocmd AuNERDTreeCmd VimEnter * call s:CdIfDirectory(expand("<amatch>"))
autocmd AuNERDTreeCmd FocusGained * call s:UpdateNERDTree()
" If the parameter is a directory, cd into it
@rickarubio
rickarubio / vimtips.vim
Created March 27, 2015 03:52
Open directory in vim or mvim with a blank buffer
" Add this to your .vimrc
if isdirectory(argv(0))
bd
autocmd vimenter * exe "cd" argv(0)
autocmd VimEnter * NERDTree
endif
require 'benchmark'
def benchmark
time_in_seconds = Benchmark.realtime { yield }
time_in_milliseconds(time_in_seconds)
end
def time_in_milliseconds(time_in_seconds)
(time_in_seconds * 1000).to_s + ' ms'
end
@rickarubio
rickarubio / big-o-benchmark-o(n).rb
Created May 30, 2015 23:25
Order of n O(n) Example
require 'benchmark'
def benchmark
time_in_seconds = Benchmark.realtime { yield }
time_in_milliseconds(time_in_seconds)
end
def time_in_milliseconds(time_in_seconds)
(time_in_seconds * 1000).round(2).to_s + ' ms'
end
@rickarubio
rickarubio / CustomComponent-test.js
Created February 27, 2018 20:49 — forked from mirague/CustomComponent-test.js
Testing React-Intl components with Enzyme's mount() and shallow() methods. This is a helper function which wraps the `intl` context around your component tests in an easy and efficient way.
import { mountWithIntl } from 'helpers/intl-enzyme-test-helper.js';
const wrapper = mountWithIntl(
<CustomComponent />
);
expect(wrapper.state('foo')).to.equal('bar'); // OK
expect(wrapper.text()).to.equal('Hello World!'); // OK
@rickarubio
rickarubio / README.md
Created January 10, 2020 06:11 — forked from hofmannsven/README.md
Increase key repeat rate on macOS

Increase key repeat rate on macOS

Settings: System Preferences » Keyboard » Key Repeat/Delay Until Repeat

Use the commands below to increase the key repeat rate on macOS beyond the possible settings via the user interface. The changes aren't applied until you restart your computer.

Source: https://apple.stackexchange.com/a/83923