Skip to content

Instantly share code, notes, and snippets.

View klauskpm's full-sized avatar
:shipit:
Making weird things useful

Klaus Kazlauskas klauskpm

:shipit:
Making weird things useful
  • Brasil
View GitHub Profile
#! /usr/bin/python
""" PHP install script. Tested with ubuntu 12.10"""
import os
ubuntu_packs = [
"mysql-server",
"mysql-client",
"libxml2-dev",
"libicu-dev",
@klauskpm
klauskpm / verify_undefined.js
Created January 29, 2014 21:44
Functions to know if the variable is defined and to set a default value if not.
function defaultIfUndefined(variable, value) {
return isUndefined(variable)?value:variable;
}
function isUndefined(variable) {
return typeof(variable)=='undefined';
}
@klauskpm
klauskpm / jquery-before-unload.js
Created April 14, 2014 19:29
Jquery - Before Unload
$(window).bind("beforeunload",function(evento)
{
// Insert the text that you want to return in the box
return "Text of the box";
}).unload(function()
{
// Any action that you want to do if chose do leave
});
@klauskpm
klauskpm / codigos-ajuda.md
Last active August 29, 2015 14:08
Arquivo com lembretes de códigos que podem ajudar.
@klauskpm
klauskpm / MY_Router.php
Created November 13, 2014 13:01
Classe de Router para CodeIgniter, criado para facilitar o manuseio das rotas e próprio entendimento.
<?php
class MY_Router extends CI_Router {
private $rotas = array(); // Contem todas as rotas so sistema
private $classe; // Classe onde está sendo chamado
private $metodo; // Método onde está sendo chamado
public function __construct()
{
@klauskpm
klauskpm / jquery-scroll.js
Last active August 29, 2015 14:09
jQuery plugin to animate and scroll to it's destination.
// jQuery Plugin - ScrollToMe
//
// Needs:
// - jQuery(2.1.1) >> http://code.jquery.com/jquery-2.1.1.js
(function($) {
/**
* Plugin to scroll the page till it element
* @param {Object.<(string|integer), string>} options Object with
* duration time(duration) and animation style(easing)
* @returns {jQuery.this}
@klauskpm
klauskpm / jquery-centralize.js
Last active August 29, 2015 14:09
Plugin to centralize the element according to the window
// jQuery Plugin - Centralize
//
// Needs:
// - jQuery(2.1.1) >> http://code.jquery.com/jquery-2.1.1.js
(function($) {
/**
* Plugin to centralize the element according to the window
* @param {boolean} resize If true, it will resize everytime the window
* resizes
* @returns {jQuery.this}
@klauskpm
klauskpm / blink-cursor.css
Created November 17, 2014 15:00
Creates a simple Cursor
@klauskpm
klauskpm / jquery-loader.js
Last active August 29, 2015 14:10
Plugin to create an waiting page until something is done
// jQuery Plugin - Loader
//
// Needs:
// - jQuery(2.1.1) >> http://code.jquery.com/jquery-2.1.1.js
// - Centralize >> https://gist.github.com/klauskpm/fc25fef2b4c94131d854
(function($) {
/**
* Plugin to create an waiting page until something is done
* @param {Object.<array, integer, boolean>} options Object with waiting
* texts(texts), time span between actions(interval), and the option to
@klauskpm
klauskpm / jquery-attrs.js
Last active August 29, 2015 14:10
Plugin to retrieve all attributes of a element
// jQuery Plugin - Loader
//
// Needs:
// - jQuery(2.1.1) >> http://code.jquery.com/jquery-2.1.1.js
(function($) {
/**
* Plugin to retrieve all attributes of a element
* @returns {Object}
*/
$.fn.attrs = function(){