Skip to content

Instantly share code, notes, and snippets.

View 0livier's full-sized avatar
😸

Olivier Garcia 0livier

😸
View GitHub Profile
@jamiepenney
jamiepenney / bootstrap_form_builder.rb
Created September 23, 2011 01:47
Form builder for Twitter Bootstrap form elements.
class BootstrapFormBuilder < ActionView::Helpers::FormBuilder
def get_error_text(object, field, options)
if object.nil? || options[:hide_errors]
""
else
errors = object.errors[field.to_sym]
if errors.empty? then "" else errors.first end
end
end
@alexstone
alexstone / slack_notification.php
Created March 3, 2014 06:54
Fire a Slack Notification via CURL
<?php
// (string) $message - message to be passed to Slack
// (string) $room - room in which to write the message, too
// (string) $icon - You can set up custom emoji icons to use with each message
public static function slack($message, $room = "engineering", $icon = ":longbox:") {
$room = ($room) ? $room : "engineering";
$data = "payload=" . json_encode(array(
"channel" => "#{$room}",
"text" => $message,
@Raphhh
Raphhh / PHPStorm-code-template.md
Last active January 28, 2016 08:53
Templates for getter and setter in PHPStorm

#PHP getter method

/**
 * Getter of $${PARAM_NAME}
 *
 * @return ${TYPE_HINT}
 */
#if (${TYPE_HINT} == "bool" || ${TYPE_HINT} == "boolean")
public ${STATIC} function ${PARAM_NAME}()
@Swop
Swop / Dominos.py
Created March 14, 2016 19:56
Check Domino's pizza delivery status and push an OSX notification after each status change. Yummy
import json
import urllib2
import sys
import time
from Foundation import NSUserNotification
from Foundation import NSUserNotificationCenter
from Foundation import NSUserNotificationDefaultSoundName
orderId = sys.argv[1]
step = previousStep = None