Skip to content

Instantly share code, notes, and snippets.

View stevenscg's full-sized avatar

Chris Stevens stevenscg

View GitHub Profile
@niyazpk
niyazpk / pQuery.js
Created October 25, 2014 14:03
Add or update query string parameter
// Add / Update a key-value pair in the URL query parameters
function updateUrlParameter(uri, key, value) {
// remove the hash part before operating on the uri
var i = uri.indexOf('#');
var hash = i === -1 ? '' : uri.substr(i);
uri = i === -1 ? uri : uri.substr(0, i);
var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i");
var separator = uri.indexOf('?') !== -1 ? "&" : "?";
if (uri.match(re)) {
@voidfiles
voidfiles / flickr_action_queue.js
Created November 25, 2011 22:43
Flickrs actionQueue code isolated
(function(F) {
var registered_ids = {},
id_to_module_map = {},
interim_actions = {},
cleanup_actions = {},
clicked_ids = {},
queueing = true;
function register_id(id, callbacks, required_module) {
id = id.replace('*', '.*');
@voidfiles
voidfiles / actionQueue.js
Created November 27, 2011 19:42
actionQueue
(function(A) {
var registered_ids = {},
id_to_module_map = {},
interim_actions = {},
cleanup_actions = {},
clicked_ids = {},
queueing = {};
function register_id(id, callbacks, required_module) {
id = id.replace('*', '.*');
// RATER MODULE for Appcelerator Titanium
/*
WHAT IS IT:
Create a cycling reminder to go rate your app at the App Store. Tracks
the app launch count, and reminds the user every 20 launches (configurable) to
rate the app, with a click to launch the app page in the App Store.
Reminders stop if the user clicks the "Rate Now" or "Don't Remind Me" options.
USAGE:
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 3, 2024 19:09
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@denji
denji / nginx-tuning.md
Last active May 3, 2024 03:57
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@dergachev
dergachev / GIF-Screencast-OSX.md
Last active May 2, 2024 05:55
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@jimbojsb
jimbojsb / gist:1630790
Created January 18, 2012 03:52
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@marktheunissen
marktheunissen / pedantically_commented_playbook.yml
Last active April 26, 2024 23:26 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
This playbook has been removed as it is now very outdated.
@ziadoz
ziadoz / awesome-php.md
Last active April 17, 2024 21:06
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.