Skip to content

Instantly share code, notes, and snippets.

View catchamonkey's full-sized avatar
👨‍💻

Chris Sedlmayr catchamonkey

👨‍💻
View GitHub Profile
<?php
/**
* sfWidgetFormChoiceAutocomplete represents a multiple select displayed as an autocomplete input and a list of checkboxes.
*
*
* @package symfony
* @subpackage widget
* @author Gerald Estadieu <gestadieu@usj.edu.mo>
* @version
*/
@catchamonkey
catchamonkey / gist:780168
Created January 14, 2011 20:24
Blackberry Facebook errors
Warning (2): file_get_contents(https://graph.facebook.com/BlackBerry/posts) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request [APP/controllers/fp_controller.php, line 15]
Notice (8): Trying to get property of non-object [APP/controllers/fp_controller.php, line 20]
Warning (2): Invalid argument supplied for foreach() [APP/controllers/fp_controller.php, line 20]
Example: You have a branch 'refactor' that is quite different from master. You can't merge all of the
commits, or even every hunk in any single commit or master will break, but you have made a lot of
improvements there that you would like to bring over to master.
# on master
> git co -b temp
# on temp
> git merge --no-commit --no-ff refactor
/**
* Provides requestAnimationFrame in a cross browser way.
* @author greggman / http://greggman.com/
*/
if ( !window.requestAnimationFrame ) {
window.requestAnimationFrame = ( function() {
return window.requestAnimationFrame ||
@catchamonkey
catchamonkey / ioreg.battery.sh
Created August 3, 2011 20:54
Display some battery information about your Mac
ioreg -w0 -l | grep -E "Capacity|Cycle Count|DesignCycleCount"
@catchamonkey
catchamonkey / Base Layout
Created August 5, 2011 21:04
base.html.twig
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{% block title %}Welcome!{% endblock %}</title>
{% stylesheets
'@SedlmayrReportsBundle/Resources/public/css/styles.css'
'@SedlmayrReportsBundle/Resources/public/css/reset.css'
%}
<link href="{{ asset_url }}" type="text/css" rel="stylesheet" />
@catchamonkey
catchamonkey / Call List Template
Created August 5, 2011 21:09
calls.html.twig
{% extends "::base.html.twig" %}
{% stylesheets
'@SedlmayrReportsBundle/Resources/public/css/listReport.css'
%}
<link href="{{ asset_url }}" type="text/css" rel="stylesheet" />
{% endstylesheets %}
{% block body %}
@catchamonkey
catchamonkey / skipSpotify.applescript
Created August 11, 2011 15:17
Apple Script to Skip Spotify Track (before my buttons worked)
tell application "System Events" to set appList to name of application processes whose frontmost is true
set activeApp to item 1 of appList
tell application "Spotify" to activate
tell application "System Events"
tell process "Spotify"
click menu item 3 of menu 1 of menu bar item 6 of menu bar 1
end tell
end tell
tell application activeApp to activate
@catchamonkey
catchamonkey / php_get_var_name.php
Created August 31, 2011 11:46
Get the name of a variable in PHP
<?php
class VarName {
function get(&$var, $scope = FALSE, $prefix = 'unique', $suffix = 'value')
{
if($scope) $vals = $scope;
else $vals = $GLOBALS;
$old = $var;
$var = $new = $prefix.rand().$suffix;
@catchamonkey
catchamonkey / stdInMailer.php
Created November 9, 2011 12:28
Mail your Errors during development without Nagios/Ossec
<?php
// during development you can simply have all Error mentions in your logs (presumably you are logging properly?) mailed to you.
// in production you may be using OSSEC/Nagios etc, but this is a quick win for dev.
// to run, you would do something like
// tail -f /var/log/messages |grep Error | php /home/sites/poc/stdInMailer.php
$fp = fopen("php://stdin","r");