Angular sample code
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
This is a initial text. Standard edit2 Added on master |
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
// usage: | |
// $('img').resizer({maxWidth: 100}); | |
$.fn.resizer = function(options){ | |
this.each(function(k, v){ | |
var d; | |
var self = $(v); | |
self.on('load', function(){ | |
if (options.maxWidth){ | |
if (self.width() > options.maxWidth){ |
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 | |
/** | |
* This script is a edited version for CakePHP2.x to work | |
* original: http://bakery.cakephp.org/articles/AD7six/2008/01/24/visualize-schema-task | |
*/ | |
/** | |
* | |
* Visualize console task | |
* |
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 | |
$options = array('colDelimiter' => ','); | |
csv('./test.csv', $options, function($row){ | |
var_dump($row); | |
}); | |
function csv($fp, $options = array(), $callback = null){ | |
if (is_string($fp)){ | |
$fp = fopen($fp, 'r'); |
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
class CsvFileIterator implements \Iterator{ | |
protected $in; | |
protected $fp; | |
protected $index; | |
protected $current; | |
public function __construct($in, $options = array()) { | |
$this->in = $in; | |
$this->options = array_merge(array( | |
'column_separator' => ',' | |
), $options); |
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 | |
/** | |
* This is a Slim middleware that provides http basic authentication. | |
* | |
* usage: | |
* | |
* $app->add(new HttpBasicAuth(array( | |
* 'users' => array('username' => 'password'), | |
* 'when' => function(\Slim\Http\Request $req, $res){ | |
* return $req->getPathInfo() === '/admin'; |
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
<html> | |
<section>hoge</section> | |
</html> |
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 | |
error_reporting(E_ALL); | |
ini_set('display_errors', 'On'); | |
function index(){ | |
?><!doctype html> | |
<html> | |
<head> | |
<style type="text/css"> | |
</style> |
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
<html><head><meta charset="UTF-8" /></head><body> | |
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script> | |
<a href="#" class="s">Success</a> | |
<a href="#" class="f">Fail</a> | |
<script> | |
var df = jQuery.Deferred(); | |
df.then(function(){ | |
alert('then'); |