Skip to content

Instantly share code, notes, and snippets.

View Javiani's full-sized avatar

Eduardo Ottaviani Aragão Javiani

View GitHub Profile
@Javiani
Javiani / Merge replace
Last active September 26, 2015 09:17
Replacing string variables
/*
Use case:
template = $('#template');
merge({ name :'My name'}, template.html()); // <div>My name</div>
<script type="text/html">
<div>#{name}</div>
</script>
*/
@Javiani
Javiani / JS Eval Function
Created July 10, 2011 15:44
New Scholl Javascript Eval
(new Function('return ' + object))()
@Javiani
Javiani / .vimrc
Last active August 29, 2015 14:18
.vimrc
" =======================================
" .vimrc file
" =======================================
"
" My default config and plugins for vim :)
" Weslley Araujo <http://github.com/weslleyaraujo>
" =======================================
" =======================================
" My default configs
@Javiani
Javiani / customEvent
Created October 9, 2015 17:30
Custom Event
Event = (function(){
try {
var p = new CustomEvent('c', { detail: { foo: 'b' } });
if('c' === p.type && 'b' === p.detail.foo)
return CustomEvent;
} catch (e) {
return 'function' === typeof document.createEvent ? function(type, params) {
var e = document.createEvent('CustomEvent');
params = params || {};
@Javiani
Javiani / product-list-replace.js
Last active November 26, 2015 19:32
product-list-replace
;(function(){
var
lists = $('.product-list'),
services = '/services/get-complete-product-vo.jsp',
n = 2;
lists.each( eachList );
function eachList(idx, ul){
@Javiani
Javiani / encoding-decoding-cookie.txt
Last active November 27, 2015 19:43
encoding-decoding-cookie
@Javiani
Javiani / mailchimp_subscribe_user.php
Created January 17, 2016 01:29 — forked from sabaraouf/mailchimp_subscribe_user.php
MailChimp API - Subscribe User
<?php
$api_key = "YOUR_API_KEY";
$list_id = "YOUR_LIST_ID";
require('Mailchimp.php');
$Mailchimp = new Mailchimp( $api_key );
$Mailchimp_Lists = new Mailchimp_Lists( $Mailchimp );
$subscriber = $Mailchimp_Lists->subscribe( $list_id, array( 'email' => htmlentities($_POST['email']) ) );
if ( ! empty( $subscriber['leid'] ) ) {
@Javiani
Javiani / uri.js
Created April 1, 2016 15:07 — forked from jlong/uri.js
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@Javiani
Javiani / .eslintrc
Created April 23, 2016 21:53
.eslintrc
{
"rules": {
"indent": [2,"tab"],
"quotes": [2,"single"],
"linebreak-style": [2,"unix"],
"semi": [2,"never"],
"no-unused-vars": ["error", { "vars": "all", "args": "none" }]
},
"env": {
"es6": true,
@Javiani
Javiani / git-zip-files.sh
Created August 22, 2016 02:54
zip-by-log ( Git version )
git archive --format=zip HEAD `git diff HEAD^ HEAD --name-only` > a.zip