This file contains hidden or 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
-- Example of how to include an if conditional in a where clause | |
-- We only want rows where a = 1 or 2 but only a = 2 if b = 4 | |
-- table structure: | |
-- [ a | b ] | |
-- 1 4 | |
-- 2 4 | |
-- 1 5 | |
-- 3 9 | |
-- 2 7 |
This file contains hidden or 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
{# | |
time can be any string acceptable by http://www.php.net/strtotime, the | |
template will output that time's month. | |
If you don't want to pass in a date you can set time like this: | |
{% set time = "now"|date("U") %} | |
{% set time = "December 2012"|date("U") %} | |
How ever you want to output items onto the calendar is a different issue, | |
but I'd assume pushing everything into an array numerically indexed by that day: |
This file contains hidden or 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 | |
class Model | |
{ | |
/* armazena os dados retornado do banco de dados */ | |
private $data; | |
/* construtor */ | |
public function __construct($data) | |
{ | |
$this->data = $data; |
This file contains hidden or 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 | |
$record = array( | |
array( | |
'id' => 1, | |
'titulo' => 'Post 1', | |
'descricao' => 'Este é o meu primeiro post :D' | |
), | |
array( | |
'id' => 2, | |
'titulo' => 'Post 2', |
This file contains hidden or 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 | |
$token_list = array('_4as82-6assda79sasg_da7s39sa3f32ar6rta' => true,'s796as7dafsdf67d60s9s_df7das67d-796f' => false); | |
$app->hook( | |
'slim.before.router', | |
function () use ($app, $token_list) { | |
$req = $app->request(); | |
$current_path = $req->getPathInfo(); | |
if (!empty($current_path) && $current_path != '/') { | |
$access_token = $req->get('access_token'); | |
if (!isset($token_list[$access_token]) || $token_list[$access_token] !== true) { |
This file contains hidden or 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( global, factory ) { | |
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { | |
module.exports = factory(global); | |
} else if (typeof define === 'function' && define.amd) { | |
define([], function() { | |
return factory(global); | |
}); | |
} else { | |
global.Utilitarios = factory(global); | |
} |
This file contains hidden or 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
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { | |
module.exports = Utilitarios; | |
} else if (typeof define === 'function' && define.amd) { | |
define([], function() { | |
return Utilitarios; | |
}); | |
} else { | |
window.Utilitarios = Utilitarios; | |
} |
This file contains hidden or 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() { | |
var Utilitarios = (function() { | |
var Utilitarios = function(options) { | |
}; | |
Utilitarios.prototype.isNull = function(obj) { | |
return obj === null; | |
}; | |
Utilitarios.prototype.isUndefined = function(obj) { |
This file contains hidden or 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 Utilitarios = (function() { | |
var Utilitarios = function(options) { | |
}; | |
Utilitarios.prototype.isNull = function(obj) { | |
return obj === null; | |
}; | |
Utilitarios.prototype.isUndefined = function(obj) { | |
return obj === void 0; |
This file contains hidden or 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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Minha aplicação</title> | |
<script src="utilitarios.js"></script> | |
<script> | |
var util = new Utilitarios(), | |
saldo = null; |