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 | |
App::uses('Model', 'Model'); | |
class AppModel extends Model { | |
public $findMethods = array('noModelName' => true); | |
protected function _findNoModelName($state, $query, $results = array()) { | |
if ($state == 'before') { | |
return $query; | |
} elseif ($state == 'after') { | |
$modelNameKey = $this->name.'.'; | |
$resultsNoModelName = 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
var paramstr = ''; | |
for (var key in params) { | |
if (params[key] instanceof Array){ | |
for (var i = 0; i < params[key].length; i++) { | |
paramstr = paramstr+key+'[]='+params[key][i]+'&'; | |
} | |
}else{ | |
paramstr = paramstr+key+'='+params[key]+'&'; | |
} | |
} |
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 | |
$output = ''; | |
$comment = 'あいうえお'; | |
if (isset($_POST['comment'])){ | |
$comment = $_POST['comment']; | |
if (preg_match("/[あ-ん]/", $comment)) | |
{ | |
$outputs = Array(); | |
$outputs[] = 'MATCH'; | |
$outputs[] = 'ret:'.preg_match("/[あ-ん]/", $comment, $match,PREG_OFFSET_CAPTURE); |
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 'active_support/core_ext/hash' | |
module GeoUtils | |
extend self | |
# 様々な緯度経度フォーマットのデータを入出力する関数 | |
# 入力: 以下の5パターンの引数が想定されている | |
# lat lng FORMAT 数値二つ | |
# "lat" "lng" FORMAT 文字列二つ | |
# "lat,lng" FORMAT カンマ区切りの文字列一つ | |
# [lat,lng] FORMAT 配列 |
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 mapview(_args) { | |
var win = Titanium.UI.createWindow({ | |
title:_args.title | |
}); | |
var isAndroid = false; | |
var MapModule = Titanium.Map; | |
var MapType = MapModule.STANDARD_TYPE; | |
if (Titanium.Platform.name == 'android') { | |
isAndroid = 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(){ | |
Window = require('map_view'); | |
var win = new Window({ | |
title:'map' | |
}); | |
win.open(); | |
})(); |
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
# -*- encoding: utf-8 -*- | |
require "rubygems" | |
require "selenium-webdriver" | |
require "test/unit" | |
module HtmlTestSuppeter | |
def element_present?(how, what) | |
@driver.find_element(how, what) | |
true | |
rescue Selenium::WebDriver::Error::NoSuchElementError |
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'selenium-webdriver' | |
caps = Selenium::WebDriver::Remote::Capabilities.iphone | |
caps.version = "5.0" | |
caps.platform = :MAC | |
caps[:name] = "Testing Selenium 2 with Ruby on Sauce" |
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
#main li:nth-of-type(3n), | |
#main li:nth-of-type(5n){ | |
visibility: hidden; | |
} | |
#main li:nth-of-type(3n):before, | |
#main li:nth-of-type(5n):before, | |
#main li:nth-of-type(15n):before{ | |
visibility: visible; | |
display: inline; |
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
$ emacs ~/bin/sleep | |
#!/usr/bin/osascript | |
tell application "Finder" to sleep |