Skip to content

Instantly share code, notes, and snippets.

View ryankirkman's full-sized avatar

Ryan Kirkman ryankirkman

View GitHub Profile
@ryankirkman
ryankirkman / SQLPrintingMiddleware.py
Created July 24, 2016 00:48 — forked from vstoykov/SQLPrintingMiddleware.py
Django Middleware to print sql queries in debug console
"""
Originaly code was taken from http://djangosnippets.org/snippets/290/
But I was made some improvements like:
- print URL from what queries was
- don't show queries from static URLs (MEDIA_URL and STATIC_URL, also for /favicon.ico).
- If DEBUG is False tell to django to not use this middleware
- Remove guessing of terminal width (This breaks the rendered SQL)
"""
from django.core.exceptions import MiddlewareNotUsed
from django.conf import settings
SELECT *
FROM credit_cards_history
WHERE credit_card_id = 1
ORDER BY version DESC
@ryankirkman
ryankirkman / .gitignore_global
Last active May 20, 2016 05:33 — forked from octocat/.gitignore
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
*.pyc
@ryankirkman
ryankirkman / formatjson.js
Last active September 16, 2019 02:12 — forked from kristopherjohnson/formatjson.js
Read JSON from standard input and writes formatted JSON to standard output. Requires Node.js.
#!/usr/bin/env node
// Reads JSON from stdin and writes equivalent
// nicely-formatted JSON to stdout.
var input = '';
process.stdin.resume();
process.stdin.setEncoding('utf8');
server {
root /var/www/example.com/static;
server_name example.com;
access_log /var/log/nginx/example.com.access.log;
error_log /var/log/nginx/example.com.error.log;
try_files /maintenance.html @proxy;
location @proxy {
proxy_pass http://127.0.0.1:10001;
@ryankirkman
ryankirkman / include_bashrc
Created September 28, 2014 04:45
Nice git repo search (like ack) with grep speed
# Please see: http://travisjeffery.com/b/2012/02/search-a-git-repo-like-a-ninja/
alias gg='git grep -E --break --heading --line-number'
# Case insensitive search
alias ggi='gg -i'
@ryankirkman
ryankirkman / keybase.md
Created July 4, 2014 02:10
keybase verification

Keybase proof

I hereby claim:

  • I am ryankirkman on github.
  • I am ryankirkman (https://keybase.io/ryankirkman) on keybase.
  • I have a public key whose fingerprint is 8741 9A15 5966 3AA5 4D94 7E20 C57E 59F3 7106 4090

To claim this, I am signing this object:

@ryankirkman
ryankirkman / parse_query.cs
Last active August 29, 2015 13:59
get rank from parse
var query = from gameScore in ParseObject.GetQuery("GameScore")
orderby gameScore.Get<int>("score") descending
select gameScore;
var rank = await query.CountAsync();
@ryankirkman
ryankirkman / jasmine-reporter-inject.js
Last active December 26, 2015 09:39
Inject the https://github.com/larrymyers/jasmine-reporters code into a jasmine page after it has already loaded with the sole purpose of being able to call jasmine.getJSReport() and get a valid response
jasmine.JSReporter.prototype.reportRunnerResults(jasmine.getEnv().currentRunner_);
@ryankirkman
ryankirkman / jquery_closest_prev.js
Created September 19, 2013 22:01
A jQuery function that returns the closest previous element, beginning with the current element, matching the provided selector
jQuery.fn.extend({
closestPrev: function(selector) {
if(!selector) return this.prev();
return this.is(selector)
? this
: this.prev(selector) || this.prevUntil(selector).prev();
}
});