app.get '/jade/*', (req, res) ->
fs.readFile app.get('views') + "/#{req.params}.jade", 'utf-8', (err, tpl) ->
res.json err if err
functionBody = jade.compile(
tpl, client:true, compileDebug:false
).toString().replace 'anonymous', ''
res.set 'Content-Type', 'application/javascript'
res.send """
define([], function(){
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 | |
class FormUtils { | |
/** | |
* Manipulates object using current input. | |
* | |
* @param Eloquent $eloquent | |
* @return Eloquent | |
*/ |
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
//+ | |
//@ http://jsfromhell.com/math/is-point-in-poly [v1.0] | |
function isPointInPoly(poly, pt){ | |
for(var c = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i) | |
((poly[i].y <= pt.y && pt.y < poly[j].y) || (poly[j].y <= pt.y && pt.y < poly[i].y)) | |
&& (pt.x < (poly[j].x - poly[i].x) * (pt.y - poly[i].y) / (poly[j].y - poly[i].y) + poly[i].x) | |
&& (c = !c); | |
return c; | |
} |
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 | |
// Na tabela existe uma coluna booleano "temp" que é "true" por padrão. | |
Route::get('/admin/edicao/create', function() { | |
return Redirect::to('/admin/edicao/' . Edicao::createTemp()->id); | |
}); | |
// E no modelo tem os seguintes métodos: | |
public static function createTemp() { |
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 | |
class Permission { | |
public static function ask() | |
{ | |
return static::action('Question'); | |
} | |
public static function answer() |
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 | |
class Permission | |
{ | |
public static function action($action) | |
{ | |
return self::$action(); | |
} | |
private static function ask() |
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 | |
// Generic attach m2m relationship service. | |
Route::post('/admin/attach', function() | |
{ | |
$input = Input::get(); | |
$parent = $input['parent']['name']::find($input['parent']['id']); | |
$child = $input['child']['name']::find($input['child']['id']); |
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
define(['modal/standard', 'belongs'], function(Modal, Belongs) { | |
return function(params) { | |
var modal = Modal(params).hijack(); | |
params.after = function(){ | |
modal.close(); | |
}; |
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
define(['modal/standard', 'belongs'], function(Modal, Belongs) { | |
return function(params) { | |
params.onCreate = params.onCreate || function(json, child) { | |
if (json.status !== 1) { | |
alert('Ocorreu um erro!'); | |
return; | |
} |