Skip to content

Instantly share code, notes, and snippets.

View mattisbusycom's full-sized avatar

Matthew M Kaufman mattisbusycom

View GitHub Profile
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
@jaywilliams
jaywilliams / csv_to_array.php
Created April 30, 2010 23:18
Convert a comma separated file into an associated array.
<?php
/**
* Convert a comma separated file into an associated array.
* The first row should contain the array keys.
*
* Example:
*
* @param string $filename Path to the CSV file
* @param string $delimiter The separator used in the file
* @return array
@luetkemj
luetkemj / wp-query-ref.php
Last active May 25, 2024 10:56
WP: Query $args
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/
<?php
/**
* Events Calendar Widget
*
* @link http://codex.wordpress.org/Widgets_API#Developing_Widgets
*
* @package BE_Genesis_Child
* @author Bill Erickson <bill@billerickson.net>
* @copyright Copyright (c) 2011, Bill Erickson
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
<block type="cms/block" name="block_name">
<action method="setBlockId"><id>block_code</id></action>
</block>
{{block type="cms/block" block_id="block_code"}}
{{block type="catalog/product_list" category_id="79" template="catalog/product/list_random.phtml"}}
@piotrbelina
piotrbelina / ImageFetcher.php
Created August 17, 2012 13:57
Image Fetcher
<?php
class ImageFetcher
{
protected $url;
public function __construct()
{
libxml_use_internal_errors(true);
}
@thomaspark
thomaspark / subnav.css
Last active June 6, 2023 10:19
Subnav for Bootstrap 2
section {
padding-top: 60px;
}
.subnav {
margin-bottom: 60px;
width: 100%;
height: 36px;
background-color: #eeeeee; /* Old browsers */
background-repeat: repeat-x; /* Repeat the gradient */
@piotrbelina
piotrbelina / categories.php
Created March 1, 2013 15:25
Magento categories export
<?php
/**
* Created by JetBrains PhpStorm.
* User: piotr
* Date: 01.03.13
* Time: 16:07
* To change this template use File | Settings | File Templates.
*/
require_once __DIR__ . '/../../../app/Mage.php';
@YannBrrd
YannBrrd / app.js
Last active December 17, 2015 06:49
Pagination using ElasticJS
// app.js
angular.module('cs_demo', [
'controllers',
'elasticjs.service',
'ui.bootstrap'
]);
@bjori
bjori / profile.example.php
Created September 16, 2013 21:07
The MongoDB Profiling example, using the PHP Stream Notification API For more info, see: http://bjori.blogspot.com/2013/09/query-logging-and-profiling-in-mongodb.html
<?php
class MongoNotifications {
public $reqs = array();
/* Our callback function
* The prototype is define by the PHP Stream Notification system: http://php.net/stream_notification_callback
*/
function update($notification_code, $severity, $message, $message_code, $bytes_transferred, $bytes_max) {
switch($notification_code) {