Skip to content

Instantly share code, notes, and snippets.

View grauwoelfchen's full-sized avatar
🐺
Typing with carved wooden keyboard ᕕ( ᐛ )ᕗ

Yasha grauwoelfchen

🐺
Typing with carved wooden keyboard ᕕ( ᐛ )ᕗ
View GitHub Profile
@grauwoelfchen
grauwoelfchen / gist:897604
Created April 1, 2011 01:41
Helper of CakePHP 1.3
// 1.2
$html->link('Bakery', 'http://example.com'));
// 1.3
$this->Html->link('Cafe', 'http://example.com');
@grauwoelfchen
grauwoelfchen / gist:897606
Created April 1, 2011 01:42
script tag of CakePHP 1.3
// 1.2
$javascript->link('cool_motion.js', true);
// 1.3
$this->Html->script('more_cool_motion.js', true);
@grauwoelfchen
grauwoelfchen / gist:958354
Created May 6, 2011 02:38
Activation of Terminal.app with AppleScript
tell application "Terminal"
activate
end tell
@grauwoelfchen
grauwoelfchen / gist:972516
Created May 14, 2011 19:11
Event Handler
function catchEvent(eventObj, event, eventHandler) {
if (eventObj.addEventListner) {
eventObj.addEventListner(event, eventHandler, false);
} else if (eventObj.attachEvent) {
event = 'on' + event;
eventObj.attachEvent(event, eventHandler);
}
}
function cancelEvent(event) {
git filter-branch --commit-filter '
if [ "$GIT_COMMITTER_NAME" = "OLD_NAME" ];
then
GIT_COMMITTER_NAME="NEW_NAME";
GIT_AUTHOR_NAME="NEW_NAME";
GIT_COMMITTER_EMAIL="NEW_EMAIL";
GIT_AUTHOR_EMAIL="NEW_EMAIL";
git commit-tree "$@";
else
git commit-tree "$@";
@grauwoelfchen
grauwoelfchen / gist:1295807
Created October 18, 2011 15:58
aps push script
<?php
/**
* APS Push Script without any Library.
*
* useage
* 1. create cert (catenate no-pass key and cert with em format)
* 2. edit path to your cert, device token and properties.
* 3. run script.
*
* if you want to get device token of you app,
ul#categories
width: 540px
list-style: none
margin: 15px auto 5px
padding: 10px
border: dotted 1px #cccccc
li
display: inline
padding: 5px
li.selected
ul#categories
width: 540px
list-style: none
margin: 15px auto 5px
padding: 10px
border: dotted 1px #cccccc
li
display: inline
padding: 5px
li.selected
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require 'tempfile'
file = ARGV.shift
temp = Tempfile.new('sub', '/tmp')
File.open("#{file}", "r") { |f|
@grauwoelfchen
grauwoelfchen / gist:1393068
Created November 25, 2011 08:48
subQuery for CakePHP Model
<?php
public function hoge() {
$User= ClassRegistry::init('User');
$id = 2;
// subQuerie
$conditionsSubQuery['`User2`.`id`'] = $id;
$dbo = $User->getDataSource();
$subQuery = $dbo->buildStatement(array(
'fields' => array('`User2`.`group_id`'),