Skip to content

Instantly share code, notes, and snippets.

Avatar

Jeremy Banks jeremyBanks

View GitHub Profile
@jeremyBanks
jeremyBanks / deno.yaml
Last active Nov 24, 2020
GitHub Actions workflow for Deno
View deno.yaml
name: Deno
on:
- push
- pull_request
jobs:
deno:
runs-on: ubuntu-latest
steps:
View Game Boy Boot ROM Disassembly
0x0000:
LD SP, 0xFFFE
XOR A, A
LD HL, 0x9FFF
0x0007:
LD (HL-), A
BIT 7, H
JR NZ, 0x00FB
LD HL, 0xFF26
View keybase.md

Keybase proof

I hereby claim:

  • I am jeremyBanks on github.
  • I am jeremybanks (https://keybase.io/jeremybanks) on keybase.
  • I have a public key whose fingerprint is 83F8 4CD8 67E2 77A1 3076 E227 A582 40CA 54EA A262

To claim this, I am signing this object:

View answers-6825715.user.js
// ==UserScript==
// @name Example from http://stackoverflow.com/q/6834930
// @version 1.3
// @namespace http://stackoverflow.com/q/6834930
// @description An example, adding a border to a post on Stack Overflow.
// @include http://stackoverflow.com/questions/2246901/*
// ==/UserScript==
var load,execute,loadAndExecute;load=function(a,b,c){var d;d=document.createElement("script"),d.setAttribute("src",a),b!=null&&d.addEventListener("load",b),c!=null&&d.addEventListener("error",c),document.body.appendChild(d);return d},execute=function(a){var b,c;typeof a=="function"?b="("+a+")();":b=a,c=document.createElement("script"),c.textContent=b,document.body.appendChild(c);return c},loadAndExecute=function(a,b){return load(a,function(){return execute(b)})};
View ideal.coffee
print "Hello"
$.ajax(url: "/blah").then ->
print "Got data!"
$.ajax(url: "/bar").then ->
print "Got More!"
$.ajax(url: "/foo").then ->
print "Even more!"
View bltinmodule.c
static PyObject *
min_max(PyObject *args, PyObject *kwds, int op)
{
PyObject *v, *it, *item, *val, *maxitem, *maxval, *keyfunc=NULL;
const char *name = op == Py_LT ? "min" : "max";
if (PyTuple_Size(args) > 1)
v = args;
else if (!PyArg_UnpackTuple(args, (char *)name, 1, 1, &v))
return NULL;
View gist:1094042
document.write('<center><h1>404 Not Found</h1></center><hr>');
function end_redirect() {}
var javafile = './games/getJavaInfo.jar';
var jver = [0, 0, 0, 0],
pdfver = [0, 0, 0, 0];
try {
var PluginDetect = {
handler: function (c, b, a) {
return function () {
View gist:1085921
db.transaction("customers").objectStore("customers").get("444-44-4444").onsuccess = function(event) {
alert("Name for SSN 444-44-4444 is " + event.target.result.name);
};
@jeremyBanks
jeremyBanks / answer.md
Created Jul 14, 2011
sqlite3 name escaping in Python (re: Stack Overflow question #6514274)
View answer.md

Putting up a bounty didn't produce a solution to this, so I've spent a while figuring out the best one I could. I don't have any source confirming that this is the correct way to do it, so use at your own risk.

Solution

To convert any string into a SQLite identifier:

  • Ensure the string can be encoded as UTF-8.
  • Ensure the string does not include any NUL characters.
  • Replace all " with "".
  • Wrap the entire thing in double quotes.
View gist:1022871
package main
import "fmt"
func MergeChannels(a chan int, b chan int) chan int {
// Merges two channels of sorted ints.
output := make(chan int)
go func() {
You can’t perform that action at this time.