Skip to content

Instantly share code, notes, and snippets.

View passalini's full-sized avatar

Pedro Henrique Passalini passalini

  • Campos dos Goytacazes
View GitHub Profile
@CampAsAChamp
CampAsAChamp / LetsSplitFlashingGuide.md
Last active February 3, 2021 18:46
Let's Split Flashing Guide for Windows

A Guide to Flashing a Let's Split for Beginners (Windows)


This guide is no longer being updated and instead has moved to GitHub (click and scroll down)


3 Main Steps

  • Setting Up and Installing Software
  • Building your keymap and keyboard firmware
@nicinabox
nicinabox / lets split build guide.md
Last active January 28, 2023 04:10
This guide covers building a Let's Split v2.

This guide has moved

To improve collaboration this guide is now available on GitHub.

Continue reading

@passalini
passalini / wait_for_ajax.rb
Last active April 7, 2017 14:08
Rspec/Capybara configuration to wait ajax
# Ajax testing with ruby and capybara
#
# Add this to spec/support
#
# When a link or button starts an ajax request, instead of use Capybara
# click_link, click_button and click_link_or_button methods use click_ajax_link,
# click_ajax_button and click_ajax_link_or_button methods. You can still use
# capybara methods and right after it, call wait_for_ajax method.
#
# This methods will wait until Capybara.default_wait_time for the ajax request
@passalini
passalini / upload_to_upl_io.sh
Last active August 29, 2015 14:04
Upload files to upl.io through command line
# This command receives a file as param, upload it to upl.io and copy the url to the clipboard
#
# install: copy this code to your .bashrc or .zshrc
# dependencies: curl and xclip
# example: $ upload ~/Images/image.png
upload_file() {
echo 'Uploading...'
url=`curl http://upl.io -F file=@$1 -s -f`
curl_response=$?
@passalini
passalini / directive.js
Created July 14, 2014 19:51
check passwords with angularjs's directive
.directive('equals', function() {
return {
restrict: 'A', // only activate on element attribute
require: '?ngModel', // get a hold of NgModelController
link: function(scope, elem, attrs, ngModel) {
if(!ngModel) return; // do nothing if no ng-model
// watch own value and re-validate on change
scope.$watch(attrs.ngModel, function() {
validate();
@dhoelzgen
dhoelzgen / base_controller.rb
Last active October 7, 2021 16:19
CORS in Rails 4 APIs
class API::V1::BaseController < ApplicationController
skip_before_filter :verify_authenticity_token
before_filter :cors_preflight_check
after_filter :cors_set_access_control_headers
def cors_set_access_control_headers
headers['Access-Control-Allow-Origin'] = '*'
headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'
@waldofe
waldofe / gist:9282553
Created March 1, 2014 00:04
Rspec failing tests rerun script
function zrun() {
SPEC_FILE=$1
SPEC_LOG=/tmp/rspec.log
if [ $SPEC_FILE ]; then
rspec $SPEC_FILE 2>&1 | tee $SPEC_LOG
else
cat $SPEC_LOG | grep "^rspec" | cut -d ' ' -f 2 | xargs rspec 2>&1 | tee $SPEC_LOG
fi
}
@passalini
passalini / foo.rb
Created November 26, 2013 17:38
Multiple assertions with rspec change
class Foo
attr_reader :bar, :buzz
def initialize
@bar = 1
@buzz = 1
end
def add
@bar += 1
@julionc
julionc / 00.howto_install_phantomjs.md
Last active February 21, 2024 11:01
How to install PhantomJS on Debian/Ubuntu

How to install PhantomJS on Ubuntu

Version: 1.9.8

Platform: x86_64

First, install or update to the latest system software.

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev
@skvggor
skvggor / solve.sh
Created September 8, 2013 15:54
Resolve o warning `Warning: watch ENOSPC` quando a tarefa GruntJS é chamada via terminal.
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p