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
@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->anything()
@loonies
loonies / git-cheat-sheet.md
Last active December 22, 2021 16:38
Git Cheat Sheet

Git Cheat Sheet

Although there are enough resources on the web about Git, I will keep this one for my own reference. Minimal Git version required 1.7.2.

TOC

@loonies
loonies / pubsub.js
Created October 11, 2012 14:23
jQuery pub/sub plugin by Peter Higgins
/*!
* jQuery pub/sub plugin by Peter Higgins
* https://github.com/phiggins42/bloody-jquery-plugins/blob/master/pubsub.js
*
* Modified by Tobin Bradley
*
* AFL/BSD Licensed
*/
;(function(d){
// the topic/subscription hash
@loonies
loonies / .htaccess
Last active August 28, 2018 05:45
Kohana .htaccess
# Turn on URL rewriting
RewriteEngine On
# Installation directory
RewriteBase /
# Protect hidden files from being viewed
<Files .*>
Order Deny,Allow
Deny From All
@loonies
loonies / hierarchy.php
Created November 20, 2011 21:39 — forked from devi/hierarchy.php
MySQL "Closure Table" for Kohana based on Bill Karwin design.
<?php defined('SYSPATH') or die('No direct script access.');
/**
* MySQL "Closure Table" for Kohana based on Bill Karwin design.
*
* @link http://www.slideshare.net/billkarwin/models-for-hierarchical-data
* @TODO improve
*
* sql schema:
* CREATE TABLE `closures` (
* `id` int(11) NOT NULL AUTO_INCREMENT,
#!/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

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@loonies
loonies / security.php
Created July 21, 2011 10:09
Kohana CSRF validation rule
<?php defined('SYSPATH') or die('No direct script access.');
/**
* Extension of Kohana_Security class
*
* @package Misc
* @category Security
* @author Miodrag Tokić <mtokic@gmail.com>
* @copyright (c) 2011, Miodrag Tokić
*/
class Security extends Kohana_Security {
@loonies
loonies / app-contract.md
Created December 6, 2012 16:58 — forked from lukemorton/app-contract.md
Application contract

Application contract

An application must keep to the following rules if it is to stay sane.

ActionController (POST Controller::action_*())

  • Must call one and only one UseCase
  • Must redirect to ViewController