Skip to content

Instantly share code, notes, and snippets.

View Ikke's full-sized avatar

Kevin Daudt Ikke

  • Netherlands
  • 07:11 (UTC +02:00)
View GitHub Profile
if ($submitted === FALSE)
{
// Because no data was submitted, validation will not be forced
return FALSE;
}
public function action_test_get($id)
{
$data = array(
'id' => null,
'name' => ""
);
$validate = Validate::factory($data);
echo Kohana::debug($validate->check());
}
from jsb.lib.threadloop import TimedLoop
from jsb.lib.persistconfig import PersistConfig
from jsb.lib.persist import PlugPersist
from jsb.lib.fleet import getfleet
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
#tweepy
@Ikke
Ikke / .Xresource
Created April 18, 2011 07:52
Making links clickable
URxvt.perl-ext-common: default,matcher
URxvt.urlLauncher: google-chrome
!URxvt.matcher.rend.0: Uline Bold fg7
URxvt.matcher.button: 1
<?php
$query = DB::insert('users_roles', array('user_id', 'role_id'))
->values(array($this->id, DB::expr("(".
DB::select('id')
->from('roles')
->where('name', '=', $rolename))
.")"));
echo $query
?>
<?php
/**
* @dataProvider provider
*/
public function test_set_access_token_sets_right_post_values($name, $value)
{
$mock_request = $this->getMock('HTTP_RequestWrapper');
$mock_request->expects($this->atLeastOnce())
@Ikke
Ikke / pre-commit.sh
Created January 17, 2012 15:14
Pre-commit hook for checking code style using PhpCheckStyle
#!/bin/sh
echo "Checking codestyle"
echo
maxErrorLevel=0
for file in $(git diff --cached --name-only --diff-filter=M -z HEAD)
do
echo "Checking $file"
@Ikke
Ikke / ledger-buffer.py
Created March 4, 2012 09:01
ncurses two windows side-by-side
class Buffer(object):
def __init__(self, window, lines):
self.window = window
self.lines = lines
self.buffer = [""]
def write(self, text):
lines = text.split("\n")
self.buffer[-1] += lines[0]
@Ikke
Ikke / gist:1984821
Created March 6, 2012 08:00
pre-commit hook for running phpcs on each committed PHP file
#!/usr/bin/env python
import subprocess
import re
import sys
from clint.textui import colored
from time import sleep
def parse_ranges(ranges):
parsed_ranges = []
for range_item in ranges:
@Ikke
Ikke / gist:2357689
Created April 11, 2012 07:50
Check if there are any relative urls
var checkForRelativeLinks = function() {
console.log("Checking for relative urls")
$('a').each(function () {
var url = $(this).attr('href');
if (url && url != "#" && url.substr(0, 7) != "http://" && url.substr(0, 11) != "javascript:") {
console.log(this);
}
});