Skip to content

Instantly share code, notes, and snippets.

View ryankirkman's full-sized avatar

Ryan Kirkman ryankirkman

View GitHub Profile
@ryankirkman
ryankirkman / jqm_red_theme.css
Created August 1, 2011 07:15
jQuery Mobile Red Theme - now jQuery Mobile 1.1.0 compatible
/* F - Red Theme - Extended from: https://gist.github.com/909284
-----------------------------------------------------------------------------------------------------------*/
.ui-bar-f {
border: 1px solid #A60000;
background: #FF0000;
color: #ffffff;
font-weight: bold;
text-shadow: 0 -1px 1px #BF3030;
background-image: -webkit-gradient(linear, left top, left bottom, from( #FF7373 /*{a-bar-background-start}*/), to( #FF4040 /*{a-bar-background-end}*/)); /* Saf4+, Chrome */
@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');
@ryankirkman
ryankirkman / SqlServerTableCreatorFromODBC.cs
Created July 12, 2012 00:28
Generate a Microsoft SQL Server Table from an ODBC Data Source table and bulk copy its contents. For my real world use case (servers on the same LAN) I get ~6800 rows / second for a 2 million record dataset when using this class via the Parallel class in
using System;
using System.Data.Odbc;
using System.Data.SqlClient;
namespace ODBC_Import
{
// Sourced from: http://darrylagostinelli.com/2011/06/27/create-a-sql-table-from-a-datatable-in-c-net/
// with modifications for copying from an ODBC data source
class SqlServerTableCreator
{
@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 / couchdb_delete_non_design_docs.js
Created March 17, 2011 06:51
Delete all non-design docs in CouchDB (using cradle)
var cradle = require('cradle');
var database = 'app';
cradle.setup({
host: '127.0.0.1',
port: 5984,
auth: { username: "YOUR_USERNAME", password: "YOUR_PASSWORD" }
});
@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 / 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();
}
});
@ryankirkman
ryankirkman / ZumeroResult.cs
Last active December 18, 2015 08:29
Parse the Zumero result string described at http://zumero.com/docs/zumero_core.html#zumero_sync into a strongly typed class
using System;
namespace ZumeroUtils
{
public class ZumeroResult
{
public int Partial { get; private set; }
public int Quarantine { get; private set; }
public int BytesUpFull { get; private set; }
public int BytesDownFull { get; private set; }