Skip to content

Instantly share code, notes, and snippets.

View cjsaylor's full-sized avatar

Chris Saylor cjsaylor

View GitHub Profile
@cjsaylor
cjsaylor / scrolltab_example.js
Created November 16, 2010 17:04
Scrolltab example
$('#content').scrolltab({
hoverin: function() {
$(this).stop().animate({width: '200px'}, 500);
},
hoverout: function() {
$(this).stop().animate({width: '50px'}, 500);
},
classname: 'scrolltab-content',
title: 'Content'
});
@cjsaylor
cjsaylor / qr_bookmarklet.js
Created November 17, 2010 14:49
QR Bookmarklet that opens an external window with the QR code of either selected text or the current URL
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');
})();
@cjsaylor
cjsaylor / g_chart_example.php
Created November 21, 2010 03:22
GChart example use
<?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 / .htaccess
Created June 15, 2011 02:59
Subdomain vhost_alias
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
<rewrite rules here>
</IfModule>
@cjsaylor
cjsaylor / hack.sh
Created April 1, 2012 22:53 — forked from erikh/hack.sh
OSX For Hackers
#!/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 / gist:3246834
Created August 3, 2012 11:36 — forked from fxsjy/gist:3244607
Simple Memcached server in Javascript with 100 lines of code
/* 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 / application_bootstrap.php
Created August 21, 2012 11:16
Example use of Symbiosis
<?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 / app.js
Created October 17, 2012 11:36
Bootstrap Modal with Remote Source
$(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();
});
});
@cjsaylor
cjsaylor / xdebug.ini
Created October 20, 2012 15:23
Xdebug configuration for MacGDBp
[xdebug]
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_port=9000
xdebug.remote_autostart=1
xdebug.remote_connect_back=1
@cjsaylor
cjsaylor / sample_class.php
Created November 22, 2012 14:36
Convenient PHPUnit mocking of Singleton Classes
<?php
class Sample {
public __construct() {
}
public function sayHello($name) {
return Someclass::getInstance()->hello($name);
}