Skip to content

Instantly share code, notes, and snippets.

View brentvatne's full-sized avatar
😴
☕️⚛️🏃‍♂️🐶

Brent Vatne brentvatne

😴
☕️⚛️🏃‍♂️🐶
View GitHub Profile
@brentvatne
brentvatne / quickerclip.rb
Created June 21, 2012 18:17 — forked from yeeguy/quickerclip.rb
Faster rspec tests with Paperclip
# inspired by https://gist.github.com/406460 and
# http://pivotallabs.com/users/rolson/blog/articles/1249-stubbing-out-paperclip-imagemagick-in-tests
# plus some additional monkeypatching to prevent "too many files open" err's
#
# place this file in <app root>/spec/support
#
RSpec.configure do |config|
$paperclip_stub_size = "800x800"
end
@brentvatne
brentvatne / gist:3363554
Created August 15, 2012 20:53
twitter from vim
" first install and authorize the twitter command line gem "t" `gem install t`
" authorize the t client, and put the following in your vimrc and you're good to go
function Twitter()
let result = system('t timeline -n 4')
echo "\n"
echo "\n"
echo "Four most recent tweets in your timeline:\n"
echo "\n"
echo result
@brentvatne
brentvatne / gist:3373342
Created August 16, 2012 20:23
easy pane resize with vim
" ctrl+l, h, j, k will resize panes in the directions you would expect
map <C-l> 5<C-w>>
map <C-h> 5<C-w><
map <C-j> 3<C-w>+
map <C-k> 3<C-w>-
" zoomwin plugin required, leader leader will toggle fullscreen for active pane
map <leader><leader> :ZoomWin<cr>
@brentvatne
brentvatne / gist:3758614
Created September 20, 2012 22:02
truncate by locale
module TruncationHelper
# Not all character sizes are equal, 120 characters of English text
# could take up a lot more screen space than 120 characters of
# Chinese text.
def locale_aware_truncate(text, options)
length = case I18n.locale
when :ja, :zh
options[:length][I18n.locale] || options[:length][:en] / 2
else
options[:length][:en]
class SomeClass
def some_method
some_var = "from some class"
yield
end
end
SomeClass.new.some_method do # |?|
puts ___.some_var
end
# Undo a migration regardless of whether or not its id exists in the migrations table
#
# filename eg: '20131118193730_create_people_table`
#
def unmigrate(filename)
require Rails.root.to_s + '/db/migrate/' + filename
migration_class = filename.gsub(/\d+_/, '').camelize.constantize
migration_class.down
end

App Intro Walkthrough: 1.0.0-beta.11

Add a simple intro tutorial to your app

A Pen by Ionic on CodePen.

License.

@brentvatne
brentvatne / clear_tags.rb
Created November 11, 2014 20:56
Delete all tags locally and remotely for a git repo
#!/usr/bin/env ruby
`git tag`.split(/\n/).each do |tag|
`git tag -d #{tag}`
`git push origin :refs/tags/#{tag}`
end
-rw-r--r-- 1 brentvatne staff 617015 8 Feb 14:36 testable-with-camel-snake-kebab-and-transform-keys.js
-rw-r--r-- 1 brentvatne staff 602954 8 Feb 14:53 testable-with-camel-snake-kebab-without-transform-keys.js
-rw-r--r-- 1 brentvatne staff 602458 8 Feb 14:29 testable.without-camel-snake-kebab.js
var d3 = require('d3');
var jsdom = require("jsdom-little");
var React = require('react-native');
var { View, Text } = React;
var Svg = require('./Svg');
var parseDate = d3.time.format("%d-%b-%y").parse;
var D3Chart = React.createClass({
componentDidMount() {