Skip to content

Instantly share code, notes, and snippets.

@bfagundez
bfagundez / index.html
Created March 18, 2013 22:14
A CodePen by martian. Backbone Paginate+Filter mixin - Adds a mixin to a Backbone view to paginate and filter a collection. Requires Cocktail.
<script type="text/html" id="template-mappings_grid_view">
<span class="the-number"></span>
<table class="table table-striped table-bordered table-condensed">
<thead>
<tr>
<% _.each(colDefinition, function(col) { %>
<td><%= col.name %></td>
<% }); %>
@bfagundez
bfagundez / fb auth error
Created April 29, 2015 18:58
fb auth error
2015-04-29 18:53:19 +0000]:[FATAL] -
ActionController::RedirectBackError (No HTTP_REFERER was set in the request to this action, so redirect_to :back could not be called successfully. If this is a test, make sure to specify request.env["HTTP_REFERER"].):
app/controllers/user_authentication_controller.rb:123:in `rescue in authenticate_by_facebook'
app/controllers/user_authentication_controller.rb:113:in `authenticate_by_facebook'
@bfagundez
bfagundez / combinations
Created July 9, 2015 18:51
combinations
a = ('a'..'z').to_a
b = ['1','2','3','4','5','6','7','8','9','0']
c = a+b
File.open('randomness.txt','w'){|f|
c.combination(7).map(&:join).each{|combo|
f.write(combo+'\n')
}
}
@bfagundez
bfagundez / combination_block
Last active August 29, 2015 14:24
combination_block
a = ('a'..'z').to_a
b = ['1','2','3','4','5','6','7','8','9','0']
d = ('A'..'Z').to_a
c = a+b+d
#File.open('randomness.txt','w'){|f|
allcombos = []
MAX_COMBOS = 3
c.combination(7).each_with_index do |combo,i|
@bfagundez
bfagundez / my.cnf
Last active August 29, 2015 14:24
my.cnf
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
user = mysql
@bfagundez
bfagundez / bootstrap
Last active August 29, 2015 14:24
bootstrap tom
#!/usr/bin/env bash
# add Ruby 2.2 PPA from brightbox (https://www.brightbox.com/blog/2015/01/05/ruby-2-2-0-packages-for-ubuntu/)
apt-add-repository ppa:brightbox/ruby-ng
apt-get update
apt-get install -y ruby2.2 ruby2.2-dev
apt-get install -y automake bison build-essential git-core libffi-dev libreadline6-dev libgdbm3 libgdbm-dev libncurses5-dev libssl-dev libtool libyaml-dev vim zlib1g-dev ntp
sudo apt-get install cmake cmake-gui libboost1.55-dev unzip
wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.5-m15.tar.gz
@bfagundez
bfagundez / dataerror
Created July 14, 2015 20:56
dataerror
rake aborted!
*** ERROR #import_data([]) : *** ERROR #import_geo_data([]) : *** ERROR #import([[:req, :table], [:req, :key], [:req,
sql_source], [:opt, :opts]]) : *** ERROR #sql([[:req, :sqls], [:opt, :msg], [:key, :count]]) : Mysql2::Error: Duplicat
entry '1-Anchorage' for key 'state_id__name': insert into city_aliases( city_id, name, state_id, state_name, city_nam
, city_alias_type_id, city_alias_type_name, city_alias_post_office_type_id, city_alias_post_office_type_name, abbrevia
ion, lat, lon, gmt_offset, is_mailable_name, created_at, updated_at) select src.city_id, src.name, src.state_id, src.s
ate_name, src.city_name, src.city_alias_type_id, src.city_alias_type_name, src.city_alias_post_office_type_id, src.cit
_alias_post_office_type_name, src.abbreviation, src.lat, src.lon, src.gmt_offset, src.is_mailable_name, src.created_at
src.updated_at from _city_aliases src left outer join city_aliases trgt
" Geekymartian vim rc
" When started as "evim", evim.vim will already have done these settings.
if v:progname =~? "evim"
finish
endif
" Use Vim settings, rather than Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
@bfagundez
bfagundez / native-routing.js
Last active March 24, 2016 18:08
react native routing with navigator
import HomePage from './app/components/anonymous/home/homepage'
import SignUp from './app/components/anonymous/signup/signup'
import Market from './app/components/authenticated/market/market'
import Shop from './app/components/authenticated/market/shop/shop'
class PackShop extends Component {
render() {
return (
<Navigator
style={{ flex:1 }}
@bfagundez
bfagundez / nvim config
Created March 17, 2018 18:00
nvim config
" Vim Plug (this has to be the first thing on the init.vim)
call plug#begin()
Plug 'tpope/vim-sensible'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'junegunn/vim-github-dashboard'
Plug 'cloudhead/neovim-fuzzy'
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
Plug 'bling/vim-airline'
Plug 'numkil/ag.vim'