Skip to content

Instantly share code, notes, and snippets.

View binki's full-sized avatar

Nathan Phillip Brink binki

View GitHub Profile
<?php
function _scripturebooks() {
return array("Genesis", "Exodus", "Leviticus", "Numbers", "Deuteronomy", "Joshua", "Judges", "Ruth", "1 Samuel", "2 Samuel", "1 Kings", "2 Kings", "1 Chronicles", "2 Chronicles", "Ezra", "Nehemiah", "Esther", "Job", "Psalm", "Proverbs", "Ecclesiastes", "Song of Solomon", "Isaiah", "Jeremiah", "Lamentations", "Ezekiel", "Daniel", "Hosea", "Joel", "Amos", "Obadiah", "Jonah", "Micah", "Nahum", "Habakkuk", "Zephaniah", "Haggai", "Zechariah", "Malachi", "Matthew", "Mark", "Luke", "John", "Acts", "Romans", "1 Corinthians", "2 Corinthians", "Galatians", "Ephesians", "Philippians", "Colossians", "1 Thessalonians", "2 Thessalonians", "1 Timothy", "2 Timothy", "Titus", "Philemon", "Hebrews", "James", "1 Peter", "2 Peter", "1 John", "2 John", "3 John", "Jude", "Revelation");
}
function scripturesort($a, $b) {
if ($a == $b) {return 0;}
$order=_scripturebooks();
@binki
binki / .sql
Last active August 29, 2015 14:08
SET ANSI_NULLS ON
SELECT a, b, CASE WHEN a!>b THEN 1 ELSE 0 END "a!>b", CASE WHEN a<=b THEN 1 ELSE 0 END "a<=b" FROM (SELECT 0 a, 0 b UNION SELECT 0, 1 UNION SELECT 0, NULL UNION SELECT 1, 0 UNION SELECT 1, 1 UNION SELECT 1, NULL UNION SELECT NULL, 0 UNION SELECT NULL, 1 UNION SELECT NULL, NULL) _;
SET ANSI_NULLS OFF
SELECT a, b, CASE WHEN a!>b THEN 1 ELSE 0 END "a!>b", CASE WHEN a<=b THEN 1 ELSE 0 END "a<=b" FROM (SELECT 0 a, 0 b UNION SELECT 0, 1 UNION SELECT 0, NULL UNION SELECT 1, 0 UNION SELECT 1, 1 UNION SELECT 1, NULL UNION SELECT NULL, 0 UNION SELECT NULL, 1 UNION SELECT NULL, NULL) _;
@binki
binki / gist:b841f5f5904109f6fc8f
Created November 2, 2014 05:28
initials output.txt
NathanPhillip@dcxt540p ~/AeroFS/repos/initials
$ /c/Program\ Files/JDK_64_bit/bin/java initials
NNNN NNNNNN BBBBBBBBBB
NNN NN BBBB BBBB
NNN N BBB BBB
NNNN N BBB BBB
N NNN N BBB BBB
N NN N BBB BBB
N NNN N BBB BBB
N NNN N BBBBBBBBBBB
ohnobinki@ohnopublishing ~ $ python
Python 2.7.1 (r271:86832, May 14 2011, 10:43:48)
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> range(0,2)
[0, 1]
>>> range(*[0,2])
[0, 1]
>>> def is_int(x):
... try:
... int(x)
... return True
... except:
... pass
... return False
...
>>> [int(x) if is_int(x) else x for x in 'asdf asdf 23'.split(' ')]
['asdf', 'asdf', 23]
#include <sstream>
#include <iostream>
int main(int argc, const char *const argv [])
{
std::stringstream ss;
ss.precision(2);
int rounded_value = 4;
ss << std::fixed << (double)rounded_value;
std::string s = ss.str();
@binki
binki / output.txt
Last active August 29, 2015 14:09
Selecting multiple sublists that compose a more complex object in T-SQL
(5 row(s) affected)
Id Name Network Good
----------- --------- -------------- -----------
1 honestbot anarchyirc.com 0
2 derpbot anarchyirc.com 1
3 logbot anarchyirc.com 1
4 goat anarchyirc.com 0
5 CHANFIX efnet.org 1
<Import Project="Neko2k.RandomBuildString.targets"/>
Load(128)=00:00:00.0611875
LoadParallel(128)=00:00:00.0285670
LoadAsync(128)=00:00:00.0378507
LoadAsyncParallel(128)=00:00:00.0404540
Load(1024)=00:00:00.3576118
LoadParallel(1024)=00:00:00.1329359
LoadAsync(1024)=00:00:00.1684256
LoadAsyncParallel(1024)=00:00:00.2744572
@binki
binki / output
Created January 16, 2015 19:20
Returning 0 rows does not always mean NULL…
(1 row(s) affected)
Id Name
----------- ----
1 asdf
(1 row(s) affected)
x
------------