Skip to content

Instantly share code, notes, and snippets.

View jgabriellima's full-sized avatar

João Gabriel Lima jgabriellima

View GitHub Profile
@jgabriellima
jgabriellima / ng-tweet.js
Created February 17, 2016 03:40
ng-tweet
(function() {
'use strict';
angular.module('ngTweets', []).service('tweets', ["$http", function($http) {
var service = this;
this.get = function(config) {
return $http({
url: url(config.widgetId, config.lang),
method: 'JSONP',
transformResponse: appendTransform($http.defaults.transformResponse, function(value) {
return parse(value);
@jgabriellima
jgabriellima / localstorageservice.js
Created February 17, 2016 04:06
ng-localstorage
'use strict';
/**
* @ngdoc function
* @name $localstorage
* @description
* # $localstorage
*/
angular.module('app').factory('$localstorage', function($window) {
return {
set: function(key, value) {
@jgabriellima
jgabriellima / cpf.js
Created February 17, 2016 04:07
valida cpf
function isCPF(value) {
console.log(value);
// value = jQuery.trim(value);
cpf = value.toString(); //.replace(/.|-|/gi, ''); // elimina .(ponto), -(hifem) e /(barra)
while (cpf.length < 11) cpf = "0" + cpf;
var expReg = /^0+$|^1+$|^2+$|^3+$|^4+$|^5+$|^6+$|^7+$|^8+$|^9+$/;
var a = [];
var b = new Number;
var c = 11;
for (i = 0; i < 11; i++) {
@jgabriellima
jgabriellima / mask.js
Created February 17, 2016 04:08
mascara javascript
var v_obj, v_fun;
function mascara(o, f) {
v_obj = o;
v_fun = f;
setTimeout("execmascara()", 1);
}
function execmascara() {
v_obj.value = v_fun(v_obj.value);
@jgabriellima
jgabriellima / linkify.js
Created February 17, 2016 04:08
linkify.js
if (!String.linkify) {
String.prototype.linkify = function() {
// http://, https://, ftp://
var urlPattern = /\b(?:https?|ftp):\/\/[a-z0-9-+&@#\/%?=~_|!:,.;]*[a-z0-9-+&@#\/%=~_|]/gim;
// www. sans http:// or https://
var pseudoUrlPattern = /(^|[^\/])(www\.[\S]+(\b|$))/gim;
// Email addresses
@jgabriellima
jgabriellima / ionic-validation.js
Last active April 12, 2017 12:15
ionic-validation
/*
data-req="true"
data-validation="date/cpf/email/placa"
data-eq-value=""
*/
function vform(id) {
var obj = {
status: true,
validation: {}
};
@jgabriellima
jgabriellima / alertservice.js
Created February 17, 2016 04:09
ionic-alerts
'use strict';
/**
* @ngdoc function
* @name app.service:API
* @description
* # API
*/
angular.module('app').service('Alerts', function($ionicLoading, $ionicPopup, $http, $ionicHistory, $location) {
return {
@jgabriellima
jgabriellima / ArvoreBinaria.java
Created November 16, 2016 02:43 — forked from leandrogualter/ArvoreBinaria.java
Árvore binária em java adaptando código de um amigo.
public class ArvoreBinaria {
private No raiz;
private ArvoreBinaria arvoreEsquerda;
private ArvoreBinaria arvoreDireita;
public ArvoreBinaria() { }
public ArvoreBinaria getArvoreDireita() {
return arvoreDireita;
}
export enum EVENTS {
SIGNIN,
SIGNOUT,
SIGNUP
};
export const URLS = {
signup: '/1/user/signup',
token: '/token',
requestResetPassword: '/1/user/requestResetPassword',
@jgabriellima
jgabriellima / README.md
Created February 14, 2017 03:36
imoveis mangueirao-2013

README is empty