Skip to content

Instantly share code, notes, and snippets.

View dokipen's full-sized avatar

Bob Corsaro dokipen

  • Medium.com
  • Newburyport, MA
View GitHub Profile
@dokipen
dokipen / multi-version-jquery.js
Created July 8, 2010 15:38
Multi-Version jQuery on Crack
function(my_selector) {
var old_jQuery = jQuery;
var doWork = function() {
var my_jQuery = jQuery.noConflict();
jQuery = old_jQuery;
// load up myplugin on my_jQuery
my_jQuery(my_selector).myplugin({...});
}
@dokipen
dokipen / gist:2077ce7e941f64d17691490b72cb4ea2
Created February 3, 2022 14:46
Crappy Makefile to build a pulsar-client whl for py3.7.12, M1 python, pulsar-2.9.1
BUILD_DIR=$(shell pwd)
ARCH=$(shell uname -m)
VERSION=$(shell sw_vers -productVersion | sed 's/\.[0-9]/_0/')
PYTHON_VERSION=3.7
PYTHON_PATCH_VERSION=3.7.12
PYTHON_POSTFIX=m
PYTHON_WHL_VERSION=cp$(subst .,,$(PYTHON_VERSION))-cp$(subst .,,$(PYTHON_VERSION))$(PYTHON_POSTFIX)
PYTHON_BASE=$(HOME)/.pyenv/versions/$(PYTHON_PATCH_VERSION)
PYTHON_LIBRARIES=$(PYTHON_BASE)/lib
"""
tropo.py implements resource types not yet supported by troposphere. This module
is ever changing and should be updated when troposphere is upgraded.
"""
from __future__ import print_function
from troposphere import AWSObject, AWSProperty
from troposphere.validators import positive_integer
from troposphere.ecs import (
### Keybase proof
I hereby claim:
* I am dokipen on github.
* I am doki_pen (https://keybase.io/doki_pen) on keybase.
* I have a public key ASB6BMJE2F-HO3RcgsxXNGQ_kHTAVcCv1kgnfIGgYukehgo
To claim this, I am signing this object:
@dokipen
dokipen / assoc_array.sh
Created October 28, 2016 20:27
Why don't fields set in the loop propagate out of the loop?
declare -A testthis
testthis[hello]="world"
echo "keys: ${!testthis[@]}"
printf "a\nb\nc\nd\ne\nf\n" | while read key && read value; do
testthis[$key]="${value}"
echo "keys: ${!testthis[@]}"
done
echo "keys: ${!testthis[@]}"
a = []
a[4294967294] = 1
console.log(a)
total = 4768
unpledged = 717
pledged = total - unpledged
clinton = 1279 + 18 - 3
bernie = 1027 + 47 + 3
needed = pledged / 2
assigned = clinton + bernie
remaining = pledged - assigned
bernie_needed = needed - bernie
bernie_perc_needed = bernie_needed.to_f / remaining
var hello = 0;
var values = [1,2,3,4];
for (var i = 0; i < values.length; i++) {
hello += values[i];
}
console.log(hello);
# --------------------------------------
@dokipen
dokipen / http.go
Last active January 8, 2016 17:11
func bindListener(port string) net.Listener {
for {
l, err := net.Listen("tcp", fmt.Sprintf(":%s", port))
if err != nil {
dlog("%+v", err)
time.Sleep(time.Duration(1) * time.Second)
} else {
return l
}
}
@dokipen
dokipen / player.js
Created January 28, 2014 17:50
Idomatic javascript construction.
function Player(opts) {
if (!(this instanceof Player)) {
return new Player(opts);
}
// do stuff
}