Skip to content

Instantly share code, notes, and snippets.

View LulzAugusto's full-sized avatar

Luiz Crisostomo LulzAugusto

  • Brasília, Brazil
View GitHub Profile
@LulzAugusto
LulzAugusto / jQueryAjaxUpload.js
Created June 25, 2014 19:26
How to setup a jQuery Ajax request to upload file(s)
var fileField = document.getElementById("file_picker");
var file = fileField.files[0]; // Use multiple attr in your input field to upload more than one file
var formData = new FormData();
formData.append('filecsv', file, file.name);
$.ajax({
type: "POST",
url: "",
processData: false,
contentType: false,
@LulzAugusto
LulzAugusto / sitef-date.js
Last active August 29, 2015 14:03
A simple date handler that does the job while we don't need something complex as Moment.js
/*=====================================================
*
* Sitef Date : A javascript library that handles dates in a way that fits Sitef's needs
* (c) Luiz Augusto Crisostomo 2014
*
======================================================*/
function SitefDate(date) {
var Messages = (function($) {
var Messages = {};
Messages.showMessage = function (type, message) {
showMessage(type, message, containers.pageContainer, arguments);
};
Messages.showModalMessage = function (type, message) {
showMessage(type, message, containers.modalContainer, arguments);
};
@LulzAugusto
LulzAugusto / gist:b6b70db7675909ce39d5
Created July 11, 2014 11:58
How to download a entire svn repository folder with wget (just a reminder)
wget --user=myUser --ask-password -e robots=off -r -I /repositorios/eduexpo-ios/tags/4.0.0-eduexpo-ios/source/ http://fabr.com.br/repositorios/eduexpo-ios/tags/4.0.0-eduexpo-ios/source/
@LulzAugusto
LulzAugusto / template.js
Created July 11, 2014 16:43
Template engine with underscore.js
function render(tmpl_name, tmpl_data) {
if ( !render.tmpl_cache ) {
render.tmpl_cache = {};
}
if ( ! render.tmpl_cache[tmpl_name] ) {
var tmpl_dir = '/templates';
var tmpl_url = tmpl_dir + '/' + tmpl_name + '.html';
var tmpl_string;
@LulzAugusto
LulzAugusto / jquery.sitef.paginator.js
Last active August 29, 2015 14:04
Just a little widget to handle pagination in one of the projects of the company I work for. May be useful or not, idk.
/*=====================================================
*
* jQuery Sitef Paginator
* Inform Sistemas LTDA.
*
======================================================*/
;(function ($, window, document, undefined) {
$.widget("sitef.paginator", {
@LulzAugusto
LulzAugusto / NSManagedObject+isNew.m
Created October 22, 2014 18:41
Snippet that tells you if a core data object is new or not.
//
// NSManagedObject+IsNew.m
// eduexpos
//
// Created by Luiz Augusto on 8/29/14.
// Copyright (c)
//
#import "NSManagedObject+IsNew.h"
@LulzAugusto
LulzAugusto / es.js
Last active August 29, 2015 14:16
ES6 presentation
function myFnc() {
if (true) {
let a = 'oi';
console.log(a + ' gdg'); // oi gdg
}
console.log(a); // a is not defined
}
// myFnc();
function fadeOut(el){
el.style.opacity = 1;
(function fade() {
el.style.opacity -= 0.1;
if (el.style.opacity < 0) {
el.style.display = "none";
el.classList.add('tago-playerbox-hide');
} else {
requestAnimationFrame(fade);
@LulzAugusto
LulzAugusto / gist:06cfd32433b4b797e226
Created June 18, 2015 20:01
CSS arrow without with shadow/borders
.tago-infobox-arrow {
position: absolute;
width: 32px;
height: 32px;
left: 50%;
margin-left: -16px;
bottom: -32px;
overflow: hidden;
&:before {