Skip to content

Instantly share code, notes, and snippets.

View k1LoW's full-sized avatar
🦓

Ken’ichiro Oyama k1LoW

🦓
View GitHub Profile
@k1LoW
k1LoW / diff.js
Created May 3, 2009 18:42 — forked from ucnv/diff.js
// http://ido.nu/kuma/2007/10/01/diff-onp-javascript-implementation/
/*
Copyright (c) 2007, KUMAGAI Kentaro
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of this project nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
(require 'split-root)
(defvar anything-compilation-window-height-percent 50.0)
(defun anything-compilation-window-root (buf)
(setq anything-compilation-window
(split-root-window (truncate (* (window-height)
(/ anything-compilation-window-height-percent
100.0)))))
(set-window-buffer anything-compilation-window buf))
<?php
/**
* Runs as first test to create tables.
*
* @return void
* @access public
*/
function start() {
if (isset($this->_fixtures) && isset($this->db)) {
Configure::write('Cache.di
var Hoge={
one:function (str){
setTimeout(function(){ console.log(str); },0);
return this;
},
two:function (str){
this.cancel_id = setTimeout(function(){ console.log(str);console.log(str); },0);
return this;
},
<?php
//http://buyukliev.blogspot.com/2007/08/no-more-socket-trouble-in-php.html
function fullread ($sd, $len) {
$ret = '';
$read = 0;
while ($read < $len && ($buf = fread($sd, $len - $read))) {
$read += strlen($buf);
$ret .= $buf;
}
<?php
class AppModel extends Model {
//Validation message i18n
function invalidate($field, $value = true){//$value example > __('Users Error' ,true)
parent::invalidate($field, $value);
$this->validationErrors[$field] = $value;
}
}
<?php
class AppModel extends Model {
var $withFieldName = false;
var $error_messages = array();
function _setErrorMessageI18n() {
$this->error_messages['empty'] = __('Error Hoge',true);
}
/**
* TexhTouch #0b101
*
*/
Deferred.define();
function log(i) {
console.log(i);
}
/**
* TechTouch #0b101
*
*/
$(function(){
for (var i = 0; i < 1000; i++ ) {
$('body').append($('<div>').css({backgroundColor:'#' + Math.floor(Math.random() * Math.pow(16,6)).toString(16),
top:Math.random()* 300,
left:Math.random()* 500,
/**
* TechTouch #0b101
*
*/
$(function(){
Deferred.define();
loop(1000, function() {
$('body').append($('<div>').css({backgroundColor:'#' + Math.floor(Math.random() * Math.pow(16,6)).toString(16),
top:Math.random()* 300,