Skip to content

Instantly share code, notes, and snippets.

@cowboy
cowboy / 1.script-tags.md
Last active March 25, 2021 03:56
require.js ideas

index.html

<script>
document.write('http://' + location.hostname + ':35729/livereload.js?snipver=1');
</script>
<script src="config.js"></script>
<script data-main="app" src="require.js"></script>
@cowboy
cowboy / thing.js
Created November 22, 2013 19:45
node task promise wtf
var Q = require('q');
var util = require('util');
var EventEmitter = require('events').EventEmitter;
function MyTask() {
EventEmitter.call(this);
this._deferred = Q.defer();
this.then = this._deferred.then.bind(this._deferred); // ???
}
util.extends(MyTask, EventEmitter);
@cowboy
cowboy / processing-js-idea.js
Last active December 26, 2015 11:19
processing js idea
function Processing(options) {
this.options = _.extend({}, options);
}
Processing.prototype.setColor = function(color) {
this.color = color;
};
Processing.prototype.drawLine = function(x1, y1, x2, y2) {
// draw a line using this.options.context and this.color
@cowboy
cowboy / recruiter-stalker.log
Last active May 8, 2018 12:51
recruiter stalker
[12:06] <TrevorTSG> Ben!
[12:07] <TrevorTSG> I am a technical recruiter, ipsofacto, I have no idea what's
going on here, but I have a position for a jQuery stud up
for grabs if you're game
[12:07] <TrevorTSG> here in the Boston area
[12:09] <ben_alman> nope
[12:09] <TrevorTSG> But you have to give me props for stalking you all the way
into a jquery chat room, right?
[12:15] TrevorTSG left IRC. (Ping timeout: 250 seconds)
@cowboy
cowboy / output.txt
Created October 10, 2013 15:03
JavaScript: @boazimbot algorithm improvements?
Grerchandising - granular merchandising. (prev: Grarchandising)
Rorons - remediate morons. (prev: Rerons)
Croots - crescendo shoots. (prev: Crets)
Jonspiracies - judicial conspiracies. (prev: Junspiracies)
Oviver - overhanging giver. (prev: Over)
Lares - luckiest stares. (prev: Lures)
Clapabilities - clarified capabilities. (prev: Clapabilities)
Grales - gritty sales. (prev: Griles)
Upseacher - upsetting preacher. (prev: Ucher)
Illigibility - illusionary eligibility. (prev: Iligibility)
mobile: function() {
return Modernizr.mq("only all and (max-width: 480px)");
}
@cowboy
cowboy / processing2-exports.js
Created October 7, 2013 21:29
JavaScript: exporting namespaced methods, etc
var processing2 = (function(global) {
var exports = {};
exports.drawCircle = function() {
// something
};
exports.setColor = function() {
// something
};
@cowboy
cowboy / #bf4-emblem-import-export.md
Last active April 29, 2025 16:39
JavaScript: BF4 Battlelog Emblem Import / Export

Exporting an emblem

  1. Log into BF4 Battlelog.
  2. Visit the Customize emblem page.
  3. Select the emblem you wish to export.
  4. Open the console (Ctrl-Shift-J).
  5. Enter the following code snippet to copy the raw emblem data to the clipboard:
    copy('emblem.emblem.load('+JSON.stringify(emblem.emblem.data,null,2)+');');
  6. Paste somewhere useful, like a gist. Whatever.
  7. Close the console (Ctrl-Shift-J).
@cowboy
cowboy / opts.sh
Created September 30, 2013 21:52
getopts wtf
#!/bin/bash
function my_test() {
echo '== my_test =='
local opt k s
while getopts 'ks' opt; do
echo "opt: $opt, OPTARG: $OPTARG"
# [[ "$1" == '-s' ]] && s=1
# [[ "$1" == '-k' ]] && k=1
done
@cowboy
cowboy / test.sh
Last active December 24, 2015 08:19
bash testing: bash -c "$(curl -fsSL https://gist.github.com/cowboy/6770094/raw/test.sh)"
!/bin/bash
echo '=== args ==='
echo '$0: '"$0"
echo "$@"
echo '=== ENV ==='
env