Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View klebervirgilio's full-sized avatar
🎯
Focusing

Kleber Correia klebervirgilio

🎯
Focusing
View GitHub Profile
@klebervirgilio
klebervirgilio / intergration_spec_helper.rb
Created March 13, 2016 22:09
Rspec: Drag and Drop file upload
module IntegrationSpecHelper
def drop_files files, drop_area_id
js_script = "fileList = Array();"
files.count.times do |i|
# Generate a fake input selector
page.execute_script("if ($('#seleniumUpload#{i}').length == 0) { seleniumUpload#{i} = window.$('<input/>').attr({id: 'seleniumUpload#{i}', type:'file'}).appendTo('body'); }")
# Attach file to the fake input selector through Capybara
attach_file("seleniumUpload#{i}", files[i])
# Build up the fake js event
js_script = "#{js_script} fileList.push(seleniumUpload#{i}.get(0).files[0]);"

I had some headaches yesterday while trying to upgrade to VMWare Fusion with Vagrant.

The steps that work are:

  • export your boxes from Virtualbox to OVA files
  • run 'vagrant destroy' on all your boxes
  • uninstall Virtualbox using the uninstaller script in the installer DMG
  • download VMWare Fusion
  • run 'vagrant plugin install vagrant-vmware-fusion' to install the provider plugin
  • run 'vagrant plugin license vagrant-vmware-fusion license.lic' to install the license you just bought
@klebervirgilio
klebervirgilio / ng.html
Created May 4, 2013 01:08
First AngularJS TODO App
<html ng-app="PomoDo" >
<head>
<title>NG</title>
</head>
<body>
<div id="done" ng-controller="TaskController">
<form>
<label>
Task Titlte (<span>{{tasks.length}}</span>)
</label>

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@klebervirgilio
klebervirgilio / clear_float.css
Last active December 15, 2015 12:29
CSS - clear float
/* clearfix */
.group:before,
.group:after {
content: "";
display: table;
}
.group:after {
clear: both;
}
begin
require 'hirb'
rescue LoadError
# Missing goodies, bummer
end
if defined? Hirb
# Slightly dirty hack to fully support in-session Hirb.disable/enable toggling
Hirb::View.instance_eval do
def enable_output_method
@klebervirgilio
klebervirgilio / .pryrc
Created March 26, 2013 12:55
My Methods
class Object
def _mm
case self.class
when Class
self.public_methods.sort - Object.public_methods
when Module
self.public_methods.sort - Module.public_methods
else
self.public_methods.sort - Object.new.public_methods
end
@klebervirgilio
klebervirgilio / gist:5102265
Created March 6, 2013 19:28
HEROKU RESTORE FROM PROD
heroku pgbackups:restore HEROKU_POSTGRESQL_RED_URL `heroku pgbackups:url --remote heroku` --remote staging
@klebervirgilio
klebervirgilio / gist:5093575
Created March 5, 2013 19:47
POSTGRES DUMP
PGPASSWORD='secret' /usr/bin/pg_dump --username='username' --host='localhost' --port='5432' -xc -E=utf8 database >> dump.sql
// Good this will only be called again once findFoo has completed.
;(function main() {
findFoo();
setTimeout(main, 100);
})();