Skip to content

Instantly share code, notes, and snippets.

View juanpujol's full-sized avatar
🇧🇷
Always Working Remotely

Juan Pujol juanpujol

🇧🇷
Always Working Remotely
View GitHub Profile
@juanpujol
juanpujol / .bowerrc
Last active August 29, 2015 14:06
Private Bower .bowerrc example
{ “registry”: “https://bower.mydomain.com:5678" }
@juanpujol
juanpujol / basetag.html
Last active August 29, 2015 14:03
Base tag with fallback for IE9 and IE8
<base href="/">
<!--[if lt IE 10]>
<script>
var origin = location.protocol+'//'+location.hostname+(location.port ? ':'+location.port: '');
document.write('<base href="' + origin + '"/>');
</script>
<![endif]-->
protractor.wrapDriver
protractor.setInstance
protractor.getInstance
protractor.By
protractor.By.binding
protractor.By.select
protractor.By.selectedOption
protractor.By.input
protractor.By.repeater
class Api::RegistrationsController < Api::BaseController
respond_to :json
def create
user = User.new(params[:user])
if user.save
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201
return
else
web: node server
@juanpujol
juanpujol / humanize-constant-filter.js
Created June 22, 2013 01:01
AngularJS Filter to transform a constant like strings to human text. i.e. "SUPPORT_SYSTEM" => "Support system"
angular.module('app').filter('humanizeConstant', function(){
return function(text) {
if(text) {
var string = text.split("_").join(" ").toLowerCase();
var string = string.charAt(0).toUpperCase() + string.slice(1);
return string
};
};
});
@juanpujol
juanpujol / animate-scroll.js
Last active April 4, 2023 18:23
Animate scroll for anchors with href="#"
var NavBarHeight = 70 // Change this variable to controll the top of the scroll.
$('a[href*=#]').each(function() {
var target;
target = $(this).attr('href');
return $(this).on('click', function(e) {
e.preventDefault();
setToActive($(this));
// Google Analitycs event tracking.
@juanpujol
juanpujol / contains-in-array.js
Created January 4, 2013 17:16
Add method contains to Array Prototype.
// Add method contains to Array Prototype.
Array.prototype.contains = function(obj) {
var i = this.length;
while (i--) {
if(this[i] === obj) { return true; }
}
return false;
}
@juanpujol
juanpujol / deploy.sh
Last active December 10, 2015 09:49
Quick deploy. Little shell script to connect and copy files to a server via SSH.
#!/bin/sh
# Execution:
# Without arguments the script will copy everythin on the $path
# ~ sh deploy.sh
#
# Or you can especify files or folders to copy via arguments.
# ~ sh deploy.sh index.html styles myfile.txt
# Folder: