Skip to content

Instantly share code, notes, and snippets.

View christianbundy's full-sized avatar

Christian Bundy christianbundy

  • 14:14 (UTC -07:00)
View GitHub Profile
# let's assume the command is:
# sshcd -v -q root@example.com:/path/to/file
# grabs the last argument of command, the target: "root@example.com:/path/to/file
t="${!#}"
# command to run, which I've broken down line by line
c=(
"ssh"
"-t" # force pseudo-tty allocation (http://www.openbsd.org/cgi-bin/man.cgi?query=ssh&sektion=1)
// THE WRONG WAY TO DO IT ////////////////
_([1, 2, 3]).forEach(function(num) { // for numbers 1..3, create a function that takes a `num`
$('div.' + num).click(function () { // when a div with the class `num` is clicked
console.log('you clicked ' + num); // log "you clicked `num`"
}); //
}); //
//////////////////////////////////////////
// THE RIGHT WAY TO DO IT //////////////
var bindToClick = function (num) { // create a function that takes a `num`
// Javascript implementation of the Heartbleed bug
var memory = '';
var heartbleed = function (msg, len) {
if (msg.length === 0) {
throw 'Message must not be blank';
}
len = len || msg.length;

Keybase proof

I hereby claim:

  • I am christianbundy on github.
  • I am christianbundy (https://keybase.io/christianbundy) on keybase.
  • I have a public key whose fingerprint is 17C6 C8F8 B27B 3648 8FE3 4CCE FD27 2ED3 EB5F D1ED

To claim this, I am signing this object:

@christianbundy
christianbundy / was-jesus-a-freak.md
Last active August 29, 2015 13:59
Alan Watts, July 1971

Was Jesus a freak?

A few days ago I gave a ride to a rather pleasant hippie couple who seemed to have no particular destination. I asked, "What trip are you on?" He said, "Like spiritual trip?" I said, "Yes." He said, "We’re on the Jesus trip." "Whose Jesus?" I asked, "Billy Graham’s or mine?" "Well, it’s all sort of the same, isn’t it?" It is not. For Billy Graham follows a long tradition, both Catholic and Protestant, wherein the gospel (or "good news" of Jesus has been eclipsed and perverted by pedestalization, by kicking him upstairs so as to get him out of the way, and by following a religion about Jesus instead of the religion of Jesus. Obviously, Jesus was not the man he was as a result of making Jesus Christ his personal savior. The religion of Jesus was that he knew he was a son of God, and the phrase "son of" means "of the nature of," so that a son of God is an individual who realizes that he is, and always has been, one with God. "I and the Father are one."

When Jesus spoke those words the crow

var createAlert = function (level) {
UI.registerHelper(level, function(title, msg) {
"use strict";
var str = '<strong>' + title + '</strong> ' + msg;
return '<div class="alert alert-' + level + '">' + str + '</div>';
});
}
createAlert('success');
createAlert('info');
// Gaslighting With Javascript
(function () {
var obj = {
fn : function () {}
, num: 1
, obj: {}
, str: 'Hello, world!'
};
var strict = function (fn) {
'use strict';
var args;
var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
var ARG_NAMES = /([^\s,]+)/g;
var fnStr = fn.toString().replace(STRIP_COMMENTS, '');
args = fnStr.slice(fnStr.indexOf('(')+1, fnStr.indexOf(')')).match(ARG_NAMES);
@christianbundy
christianbundy / exports.js
Last active August 29, 2015 14:02
Export variables to the global namespace with `module.exports` in the browser (or anywhere else). Example in the comments!
// Initialize an empty module object
module = {};
// Functions created this way don't inherit strict mode
exports = Function('return this')();
// Define what happens when you try to get or set `module.exports`
Object.defineProperty(module, 'exports', {
// Extend the top-level object with the object that's passed
set: function (obj) {
var system = require('system');
var address = 'http://stress-test.meteor.com';
var i = 0;
var stopping = false;
var newThread = function () {
console.log(i++);
var t = Date.now();