Skip to content

Instantly share code, notes, and snippets.

View cbess's full-sized avatar
💭
Coding for Jesus' glory. Soli Deo gloria

C. Bess cbess

💭
Coding for Jesus' glory. Soli Deo gloria
View GitHub Profile
@maccman
maccman / jquery.ajax.queue.coffee
Last active January 13, 2018 12:03
Queueing jQuery Ajax requests. Usage $.ajax({queue: true})
$ = jQuery
queues = {}
running = false
queue = (name) ->
name = 'default' if name is true
queues[name] or= []
next = (name) ->
@slightfoot
slightfoot / TestActivity.java
Last active February 10, 2018 22:31
Example of the use of a ListView with associated empty View.
import java.util.ArrayList;
import java.util.Random;
import android.app.ListActivity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
@maxpert
maxpert / nosqlite.py
Last active May 18, 2018 22:21
A really simple Document store built on top of SQLite3 using Python
'''
Copyright (c) 2013 Zohaib Sibte Hassan
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
@lukaszb
lukaszb / notify.py
Created February 21, 2013 01:23
Simple Python script to send notification to the OSX Notifications Center (requires OS X 10.8+). Tested with pyobjc 2.5.1
#!/usr/bin/env python
from Foundation import NSUserNotification
from Foundation import NSUserNotificationCenter
from Foundation import NSUserNotificationDefaultSoundName
from optparse import OptionParser
def main():
parser = OptionParser(usage='%prog -t TITLE -m MESSAGE')
@cbess
cbess / objc.cfg
Last active December 13, 2015 20:08
My Uncrustify config, based on objc.See comments for installation instructions.
#
# Uncrustify Configuration File
# File Created With UncrustifyX 0.4.3 (252)
#
# Alignment
# ---------
## Alignment
# View list of connections and their states
netstat -tan | grep ':80 ' | awk '{print $6}' | sort | uniq -c
# List all connections and timers
ss -rota | less
@mootoh
mootoh / EKEventKit+Serialize.m
Created August 26, 2012 09:02
Convert EventKit object to NSDictionary, for making it easy to serialize in JSON format.
//
// Convert EventKit object to NSDictionary, for making it easy to serialize in JSON format.
//
#import "EventKit+Serializer.h"
@implementation EKCalendarItem (Serializer)
- (NSDictionary *)toDictionary
{
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
@evildmp
evildmp / gist:3094281
Last active June 30, 2023 10:55
Set up Django, nginx and uwsgi

This document has now been incorporated into the uWSGI documentation:

http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html

Set up Django, nginx and uwsgi

Steps with explanations to set up a server using:

@debussy2k
debussy2k / string.format.js
Created June 25, 2012 02:14 — forked from tbranyen/string.format.js
safer string formatting
// Inspired by http://bit.ly/juSAWl
// Augment String.prototype to allow for easier formatting. This implementation
// doesn't completely destroy any existing String.prototype.format functions,
// and will stringify objects/arrays.
String.prototype.format = function(i, safe, arg) {
function format() {
var str = this, len = arguments.length+1;
// For each {0} {1} {n...} replace with the argument in that position. If
@samba
samba / nginx-cache.sh
Created June 15, 2012 18:24
Nginx Cache Search/Removal
#!/bin/sh
# Nginx Cache Manager (search, remove content by URL or grep)
# NOTE:
# in my nginx config, I use:
# proxy_cache_key $scheme://$host$uri$is_args$args@$remote_user;
# ... which facilitates easier searching of cache files
cachefiles () {
find /var/lib/nginx/cache -type f $@
}