Skip to content

Instantly share code, notes, and snippets.

View moiseevigor's full-sized avatar
🎯
Focusing

Igor Moiseev moiseevigor

🎯
Focusing
View GitHub Profile
@cowboy
cowboy / HEY-YOU.md
Last active May 16, 2024 13:31
jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery.
@tobsn
tobsn / loader.plugin.php
Created December 17, 2010 01:25
controller loader for slim framework
<?php
Slim::hook('slim.before.dispatch', function () {
list( $type, $controller_name, $controller_action ) = array_merge( explode( '.', Slim::router()->current()->getName() ), array( null,null,null ) );
if( $type == 'controller' ) {
$file = './controllers/'.$controller_name.'.controller.class.php';
if( !is_readable( $file ) ) { return false; }
require_once( './controllers/base.controller.class.php' );
require_once( $file );
$class = $controller_name.'Controller';
@nzjrs
nzjrs / Makefile
Created May 25, 2011 07:09
Python ctypes example
all: test libtest.so testmodule
libtest.so: libtest.c
$(CC) -Wall -g -fPIC -shared -o $@ $? -lc
test: test_main.c libtest.o
$(CC) -o $@ $?
testmodule: testmodule.c
python setup.py build
@yandod
yandod / action_mailer.php
Created May 28, 2011 18:48
ActionMailer - A reusable email class for CakePHP
<?php
/**
* Created: Sat Aug 05 02:19:40 EDT 2006
*
* A base class for application wide E-Mail sending/logic inspired
* by the Ruby on Rails ActionMailer.
*
* The Actionmailer is a hybrid of a Model and Controller since it
* renders it's own views to be send out via mail. The easiest way to
@justincampbell
justincampbell / asterisk_watchdog.sh
Created December 11, 2011 17:32
Asterisk watchdog script
#!/bin/bash -x
DIR=/tmp/watchdog
# Create dir if it doesn't exist
if [ ! -d $DIR ]; then
mkdir $DIR
fi
cd $DIR
@tj
tj / app.js
Created December 17, 2011 23:15
express 3.x cookie session middleware example
var express = require('express')
, cookieSessions = require('./cookie-sessions');
var app = express();
app.use(express.cookieParser('manny is cool'));
app.use(cookieSessions('sid'));
app.get('/', function(req, res){
req.session.count = req.session.count || 0;
@moiseevigor
moiseevigor / gist:1548565
Created January 1, 2012 22:49
ui.tabs.closable
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js"></script>
<script type="text/javascript" src="js/ui.tabs.closable.js"></script>
</head>
<body>
<script type="text/javascript">
@blazarecki
blazarecki / PopupDictionary.php
Last active November 10, 2021 15:54
Alert, confirm and prompt with mink
<?php
namespace Widop\Mink\Extension;
/**
* Dictionary to manage popups.
*
* @author Benjamin Lazarecki <benjamin.lazarecki@gmail.com>
*/
trait PopupDictionary
@domenic
domenic / promises.md
Last active March 31, 2024 14:07
You're Missing the Point of Promises

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.
@quiver
quiver / README.md
Last active April 3, 2024 15:47
Who says PostgreSQL can't Pub/Sub like Redis?

Pub/Sub pattern with PostgreSQL's LISTEN/NOTIFY command

This is a simple chat-like program using pub-sub pattern, backed by PostgreSQL's LISTEN/NOTIFY command.

Publish

publish message to foo channel from user nickname.

$ python pub.py foo nickname
PUBLISH to channel #foo