Skip to content

Instantly share code, notes, and snippets.

@christopheradams
christopheradams / git-permission-reset.sh
Created June 14, 2013 07:14
Reset file permissions in a Git repository.
git diff -p | grep -E '^(diff|old mode|new mode)' | sed -e 's/^old/NEW/;s/^new/old/;s/^NEW/new/' | git apply
@christopheradams
christopheradams / media.php
Last active December 18, 2015 12:29
Fix for framework / app / config / bootstrap / media.php
<?php
/**
* Lithium: the most rad php framework
*
* @copyright Copyright 2013, Union of RAD (http://union-of-rad.org)
* @license http://opensource.org/licenses/bsd-license.php The BSD License
*/
/**
* The `Collection` class, which serves as the base class for some of Lithium's data objects
{
"AL": "Alabama",
"AK": "Alaska",
"AS": "American Samoa",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
"DE": "Delaware",
@christopheradams
christopheradams / pluck.erl
Created April 9, 2014 14:10
Pluck function from newrelic-erlang
pluck(_, _, []) ->
[0];
pluck(Name, N, L) ->
lists:map(fun ([_, []]) -> 0;
([{Struct}, D]) ->
case binary:match(proplists:get_value(name, Struct), Name) of
nomatch ->
0;
_ ->
case proplists:get_value(scope, Struct) =:= <<"">> of
<?php
namespace app\controllers;
use app\models\Downloads;
class DownloadsController extends \lithium\action\Controller {
public function index() {
$this->request->privateKeys = array('id', 'user_id');
@christopheradams
christopheradams / media.php
Last active August 29, 2015 14:00
Custom media media handler for JSON media type.
<?php
/**
* Create a custom handler for the JSON media type. By default `Collection::to()` will force
* indexed conversion of the collection with the document ID's as keys. This is not what we want
* for our JSON API. The handler will yield a plain old JSON array for the collection instead
* of an object by setting cast to false and then devising a custom cast function in the
* encoding step.
*/
source :rubygems
gem 'webmachine'
gem 'rspec'
gem 'rspec_api_documentation'
gem 'rack-test'
gem 'json_spec'
This file has been truncated, but you can view the full file.
{
"datatypes": {
"Boolean": {
"ancestors": [
"DataType"
],
"comment": "",
"comment_plain": "",
"id": "Boolean",
"instances": [
@christopheradams
christopheradams / WebPage.json
Last active August 29, 2015 14:08
Tentacles Webpage JSON-LD example
{
"@context": "http://schema.org",
"@type": "WebPage",
"author": "Staff reporter",
"copyrightHolder": "DC Thomson & Co, Ltd.",
"copyrightYear": "2014",
"dateCreated": "2011-01-10",
"dateModified": "2012-11-12",
"datePublished": "2011-01-10",
"hasPart": {

Irssi in Mac OS X Notification Center

Mou icon

Overview

This guide will explain how you can make irc messages in a screen on a remote server appear in your Mac OS X Lion Notification Center with the help of terminal-notifier.

We will also explain how the process can be automatically started each time you log in to your Mac and ensure the connection to the server is kept alive.