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
/* | |
Usage: | |
<script src="repeat.js"></script> | |
Example: | |
<ul> | |
<li repeat="3">Hello World!</li> | |
</ul> | |
will produce: | |
<ul> | |
<li repeat="3">Hello World!</li> |
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 | |
abstract class SimpleDbQueryBuilder { | |
protected function tablesQuery() { | |
return array( | |
'sql' => "SELECT name FROM sqlite_master WHERE type = 'table';", | |
'args' => array(), | |
); | |
} |
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 | |
define('EXTENDS_PATTERN', '/\{extends ([a-z0-9_\/-]+)\}/'); | |
define('BLOCK_PATTERN', '/\{block ([a-z0-9_-]+)\}([^\{]*)\{\/block\}/'); | |
define('INCLUDE_PATTERN', '/\{include ([a-z0-9_\/-]+)\}/'); | |
function tpl_compile($file) { | |
if(!is_file($file)) { | |
throw new Exception('File "' . $file . '" is not found.'); | |
} |
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 SimpleTemplate { | |
function renderString($string, $args = NULL) { | |
if(is_array($args)) { | |
$this->validateArgs($args); | |
extract($args); | |
} | |
eval('?>' . $this->parseString($string)); |
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
' Require TypeLib Information | |
' Returns "Project1.Class1" instead of only "Class1" | |
Public Function FullTypeName(Object As Object) As String | |
FullTypeName = TLIApplication.InterfaceInfoFromObject(Object).Parent.Name & "." & TypeName(Object) | |
End Function |
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
import flash.events.MouseEvent; | |
stage.addEventListener(MouseEvent.MOUSE_WHEEL, mouseWheel); | |
var scale:Number = 1; | |
function mouseWheel(e:MouseEvent):void { | |
scale = e.delta > 0 ? scale + .5:scale - .5; | |
image.scaleX = image.scaleY = scale; | |
image.x = mouseX - e.localX * image.scaleX; |
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 x = scroll.x; | |
var y = scroll.y; | |
var minX = undefined, maxX = undefined; | |
var minY = undefined, maxY = undefined; | |
if(x < 0) { | |
while(x < paisley.width) { | |
if(x > -paisley.width) { | |
if(minX === undefined) { | |
minX = x; | |
} |
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 minX = 0, maxX = 0; | |
var minY = 0, maxY = 0; | |
if(scroll.x > 0) { | |
maxX = scroll.x % paisley.width; | |
minX = maxX > 0 ? -paisley.width + maxX : (maxX < 0 ? -paisley.width + maxX : 0); | |
} else if(scroll.x < 0) { | |
minX = scroll.x % paisley.width; | |
minX = minX == 0 ? 0 : minX; | |
maxX = minX + canvas.width; | |
maxX = maxX >= canvas.width ? minX : maxX; |
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
import flash.events.MouseEvent; | |
import flash.geom.Point; | |
import flash.display.NativeWindow; | |
var down:Boolean = false; | |
var offset:Point = new Point(); | |
stage.addEventListener(MouseEvent.MOUSE_DOWN, function(e:MouseEvent):void { | |
down = true; | |
var p:Point = new Point(e.stageX, e.stageY); |
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 SDO { | |
private $pdo; | |
function __construct(PDO $pdo) { | |
$this->pdo = $pdo; | |
} |
OlderNewer