Skip to content

Instantly share code, notes, and snippets.

View loonies's full-sized avatar
👨‍💻
Working full time

loonies

👨‍💻
Working full time
View GitHub Profile
@kasparsd
kasparsd / wordpress-plugin-svn-to-git.md
Last active April 17, 2024 12:35
Using Git with Subversion Mirroring for WordPress Plugin Development
@jwage
jwage / SplClassLoader.php
Last active April 9, 2024 21:04
Add MIT license.
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
@loonies
loonies / 1_phpunit-api.md
Last active January 19, 2024 07:34
PHPUnit Cheat Sheet

PHPUnit API reference

  • version 3.6

TODO

Check those constraints:

$this-&gt;anything()
# Video: http://rubyhoedown2008.confreaks.com/08-chris-wanstrath-keynote.html
Hi everyone, I'm Chris Wanstrath.
When Jeremy asked me to come talk, I said yes. Hell yes. Immediately. But
then I took a few moments and thought, Wait, why? Why me? What am I supposed
to say that's interesting? Something about Ruby, perhaps. Maybe the
future of it. The future of something, at least. That sounds
keynote-y.
@aliuygur
aliuygur / countries_list.php
Last active August 27, 2021 08:08
Function: Countries (php countries list array)
<?php
/**
* Countries List
* @return array
*/
function countries()
{
$countries = Array(
'AF' => 'Afghanistan',
@naholyr
naholyr / block-social-networks.sh
Created December 21, 2011 15:09
Bash Pomodoro using libnotify
#!/bin/bash
# Destination: ~/.pomodoro/hooks/work.d/
# Goal: block access to Twitter and Facebook while in a Pomodoro
# Note: won't work if you use Chrome, as it maintains an internal (not flushable from CLI) DNS cache. Fuck it.
# This file must be able to touch "/etc/hosts":
# The best way would be to create a group able to modify the "/etc/hosts" file:
# $ sudo addgroup host-manager
# $ sudo chgrp host-manager /etc/hosts
@atannus
atannus / kohana.php
Created July 6, 2013 19:38
Quick hack to allow Kohana to handle memory_limit and max_execution_time violations.
<?php defined('SYSPATH') or die('No direct script access.');
class Kohana extends Kohana_Core {
/**
* Augments the core method for two reasons:
* 1) Reserve an extra 1M memory to allow handling memory_limit violation.
* 2) Reserve more exec time to allow max_execution_time violation.
*
* Note: keep variable creation at a minimum.
<?php
class Pagination {
public static function factory($total, $limit = 5, $page = 1, $adjacents = 2)
{
return new Pagination($total, $limit, $page, $adjacents);
}
public $total;
@lukemorton
lukemorton / Controller_News.php
Created September 19, 2011 09:47
Dealing with pagination in MVVM
<?php
class Controller_News {
public function action_category()
{
$category = ORM::factory('news_category', array('url' => $this->request->param('category')));
if ( ! $category->loaded())
{
@zeelot
zeelot / bla.php
Created August 21, 2011 18:03 — forked from kiall/bla.php
Valid::at_least()
<?php defined('SYSPATH') or die('No direct script access.');
class Model_Bla extends ORM {
public function rules()
{
return array(
'phone_one' => array(
array('at_least', array(':validation', 1, array('phone_one', 'phone_two', 'phone_three'))),
),