Skip to content

Instantly share code, notes, and snippets.

Avatar

Chris Saylor cjsaylor

View GitHub Profile
@cjsaylor
cjsaylor / sample_class.php
Created Nov 22, 2012
Convenient PHPUnit mocking of Singleton Classes
View sample_class.php
<?php
class Sample {
public __construct() {
}
public function sayHello($name) {
return Someclass::getInstance()->hello($name);
}
@cjsaylor
cjsaylor / xdebug.ini
Created Oct 20, 2012
Xdebug configuration for MacGDBp
View xdebug.ini
[xdebug]
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_port=9000
xdebug.remote_autostart=1
xdebug.remote_connect_back=1
@cjsaylor
cjsaylor / app.js
Created Oct 17, 2012
Bootstrap Modal with Remote Source
View app.js
$(document).ready(function() {
$(document).on('.ajaxModal', 'click', function(event) {
$.get($(this).attr('href'), function(response) {
$('<div class="modal hide fade">' + response + '</div>').modal();
});
event.preventDefault();
});
});
View application_bootstrap.php
<?php
use \Zumba\Symbiosis\Plugin\PluginManager;
// Somewhere in your application bootstrap, load your plugins
PluginManager::loadPlugins(
'/path/to/your/plugin/directory', // Path to where you stored your plugins
'YourApp\Plugin' // namespace defined in your plugins (see example above)
);
@cjsaylor
cjsaylor / gist:3246834
Created Aug 3, 2012 — forked from fxsjy/gist:3244607
Simple Memcached server in Javascript with 100 lines of code
View gist:3246834
/* Simple Memcached in Javascript
* @Author: Sun, Junyi
* @Email: ccnusjy@gmail.com
* @Date: 2012-8-3
*/
var net = require('net');
var store = {}
function handle_header(header,crlf_len){
var tup = header.split(" ")
@cjsaylor
cjsaylor / hack.sh
Created Apr 1, 2012 — forked from erikh/hack.sh
OSX For Hackers
View hack.sh
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@cjsaylor
cjsaylor / .htaccess
Created Jun 15, 2011
Subdomain vhost_alias
View .htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
<rewrite rules here>
</IfModule>
View g_chart_example.php
<?php
$data = array(
'labels' => array(
array('string' => 'Sample'),
array('number' => 'Piston 1'),
array('number' => 'Piston 2')
),
'data' => array(
array('S1', 74.01, 74.03),
@cjsaylor
cjsaylor / qr_bookmarklet.js
Created Nov 17, 2010
QR Bookmarklet that opens an external window with the QR code of either selected text or the current URL
View qr_bookmarklet.js
javascript:(function() {
window.open('http://chart.apis.google.com/chart?cht=qr&chs=250x250&chl='+encodeURIComponent(getSelection().toString() || window.location.href)+'&chld=H|0', 'QR Window','location=0,status=0,scrollbars=0,toolbar=0,menubar=0,directories=0,resizable=0,width=250,height=250');
})();
View scrolltab_example.js
$('#content').scrolltab({
hoverin: function() {
$(this).stop().animate({width: '200px'}, 500);
},
hoverout: function() {
$(this).stop().animate({width: '50px'}, 500);
},
classname: 'scrolltab-content',
title: 'Content'
});