Skip to content

Instantly share code, notes, and snippets.

var waitForJquery = function(jqueryCallback, interval) {
if(typeof $ === 'function') {
jqueryCallback();
} else {
setTimeout(function() {
if(typeof $ === 'function'){
jqueryCallback();
} else {
waitForJquery(jqueryCallback, interval);
}
@shalecraig
shalecraig / test.cpp
Last active August 29, 2015 13:58
Testing the speed of adding and removing items from a list vs vector.
#include <time.h>
#include <iostream>
#include <list>
#include <vector>
using namespace std;
list<int> list_timed;
@shalecraig
shalecraig / pry-help
Created October 20, 2014 22:30
Help page shown in pry :D
Help
help Show a list of commands or information about a specific command
Context
cd Move into a new context (object or scope).
find-method Recursively search for a method within a Class/Module or the current namespace.
ls Show the list of vars and methods in the current scope.
pry-backtrace Show the backtrace for the Pry session.
raise-up Raise an exception out of the current pry instance.
reset Reset the REPL to a clean state.

Pre-#125

String lastId = null;
while (true) {
    BalanceTransactionCollection balanceTransactions =
            BalanceTransaction.all(
                    Collections.<String, Object>singletonMap("starting_after", lastId)
            );
    for (BalanceTransaction tx : balanceTransactions.getData()) {
        // ..
@shalecraig
shalecraig / maven_generation.md
Created January 6, 2015 15:54
I find these annoying to lookup.

Parent project:

mvn archetype:generate -DinteractiveMode=true -DarchetypeGroupId=org.codehaus.mojo.archetypes -DarchetypeArtifactId=pom-root -DarchetypeVersion=1.1

Child Project:

mvn archetype:generate -DinteractiveMode=true -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.1

Keybase proof

I hereby claim:

  • I am shalecraig on github.
  • I am shalecraig (https://keybase.io/shalecraig) on keybase.
  • I have a public key whose fingerprint is 9D5C E1FA B1EC 7A2C C155 3964 1828 B3FD 10BC 455C

To claim this, I am signing this object:

@shalecraig
shalecraig / test.cpp
Last active December 14, 2015 07:29
Kill your computer with this quick memory allocation. Thrashing guaranteed, or your money back.
#include <cstdlib>
#include <stdio.h>
#include <sys/mman.h>
int main() {
char buffer[100];
int n;
// 16 GB * 1000
void* allRam = malloc(17179869184*1000);
printf("allocated \n");
@shalecraig
shalecraig / School Makefile
Last active December 15, 2015 16:38
School Makefile that I use in the root of my school home directory.
# This is the makefile I use to organize/build/etc my school notes.
#
# The general directory structure is as follows:
# $tree courseTemplate latex_templates
# course123
# |-- assignments
# |   l-- a1
# |   |-- a1.pdf
# |   l-- a1.tex
# |-- labs
@shalecraig
shalecraig / Test.java
Created April 19, 2013 16:31
Take a guess at what this does...
public class Test {
public static void main(String[] args) {
System.out.println("One");
}
static {
System.out.println("Two");
}