This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | |
/** | |
* CodeIgniter Login Class | |
* This class enables you to have a simple login route and permission levels | |
* | |
* @package CodeIgniter | |
* @subpackage Libraries | |
* @category Libraries | |
* @author Weslley Araujo (http://weslleydeveloper.com) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def date_to_unix(time) | |
Time.parse(time).to_i | |
end | |
def in_progress(start_time, end_time, time_now = (Time.new.strftime '%d/%m/%Y')) | |
now = date_to_unix(time_now) | |
if date_to_unix(start_time) <= now | |
date_to_unix(end_time) < now ? false : true | |
else | |
false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function padding(str, len, char) { | |
return (Array(len).join(char)+str).substr(-len); | |
} | |
padding(1, 2, 0) // 01 | |
padding(1, 2, 0) // 02 | |
padding(1, 2, 0) // 27 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var users = [ | |
'yellow', | |
'green', | |
'pink', | |
'blue' | |
]; | |
var sepa = []; | |
for (var i in users) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Simple JavaScript Templating | |
// John Resig - http://ejohn.org/ - MIT Licensed | |
(function(){ | |
var cache = {}; | |
this.tmpl = function tmpl(str, data){ | |
// Figure out if we're getting a template, or if we need to | |
// load the template - and be sure to cache the result. | |
var fn = !/\W/.test(str) ? | |
cache[str] = cache[str] || |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String.prototype.trunc = function(n){ | |
return this.length>n ? this.substr(0,n-1)+'…' : this; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var slug = function (text) { | |
return text | |
.toLowerCase() | |
.replace(/[^\w ]+/g,'') | |
.replace(/ +/g,'-'); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var truncate = function(string, n, terminator) { | |
if (typeof string !== 'string') { | |
return; | |
} | |
var lastIndex = string.lastIndexOf(' ', n), ret = string.toString(); | |
if(ret.length <= n) return ret; | |
if (lastIndex != -1) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fn = function even (n) { | |
if (n === 0) { | |
return true | |
} | |
else return !even(n - 1) | |
} | |
fn(5); | |
//=> false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ClassName = (function () { | |
var | |
// here is the place to inject private methods | |
_private = {}, | |
// all attributes values goes here | |
attributes = { | |
}; | |
function ClassName (args) { |
OlderNewer