Skip to content

Instantly share code, notes, and snippets.

@SZanlongo
SZanlongo / listToChunks.py
Created September 18, 2014 02:04
Split a list into evenly sized chunks
# https://stackoverflow.com/questions/312443/how-do-you-split-a-list-into-evenly-sized-chunks-in-python
l = range(1, 1000)
def chunks(l, n):
# Yield successive n-sized chunks from l
for i in xrange(0, len(l), n):
yield l[i:i + n]
import pprint
pprint.pprint(list(chunks(range(10, 75), 10)))
@SZanlongo
SZanlongo / consoleProgressBar.py
Created September 18, 2014 02:05
Progress Bar
# https://stackoverflow.com/questions/691946/short-and-useful-python-snippets
class ProgressBar():
def __init__(self, width=50):
self.pointer = 0
self.width = width
def __call__(self, x):
# x in percent
self.pointer = int(self.width * (x / 100.0))
return "|" + "#"*self.pointer + "-"*(self.width - self.pointer) + \
@SZanlongo
SZanlongo / iTunes.bat
Created October 13, 2014 12:05
Starts iTunes services and iTunes. When iTunes is closed, also shuts down all associated services.
net start "Apple Mobile Device"
net start "iPod Service"
"C:\Program Files (x86)\iTunes\itunes.exe"
net stop "iPod Service"
net stop "Apple Mobile Device"
@SZanlongo
SZanlongo / makeFolderFromFile.bat
Created October 13, 2014 12:06
Takes in a text file and generates folders based on each line of text.
@echo off
for /f "tokens=*" %%a in (file.txt) do (
mkdir "%%a"
)
\documentclass{article}
\usepackage{amsmath}
\usepackage{algorithm}
\usepackage[noend]{algpseudocode}
\makeatletter
\def\BState{\State\hskip-\ALG@thistlm}
\makeatother
\begin{document}
private static double[][] RandomArray(int n) {
double[][] randomMatrix = new double [n][n];
Random rand = new Random();
rand.setSeed(System.currentTimeMillis());
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
Integer r = rand.nextInt()% 100;
randomMatrix[i][j] = Math.abs(r);
}
public void printGraph(double[][] array, int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
System.out.println(array[i][j]);
}
}
}
public void printGraph(double[][] array, int n) {
for (int i = 0; i < n; i++) {
System.out.print(" [ ");
for (int j = 0; j < n; j++) {
System.out.print(array[i][j]);
}
//Put println instead of print here to have each row in a new line
System.out.print(" ]");
}
}
@SZanlongo
SZanlongo / animateBalls.js
Created December 9, 2014 19:37
Ball animation with different effects
// Based off code from here - http://www.reddit.com/r/gifs/comments/2on8si/connecting_to_server_so_mesmerizing/cmow0sz
var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');
var numBalls = 24; // numb balls
var timeStep = 0;
var ballYTravel = 100;
var ballRadius = 5;
var ballSpace = 20;
@SZanlongo
SZanlongo / qaTips.md
Created January 5, 2015 20:55
Tips for software developers to make working with QA testers a little easier

QA Tips

Send useful bug/task feedback

The DB is where most of the time is spent:

  • logging new issues
  • answering questions from other developers
  • regressing bugs

Keeping a clean DB is very useful; add extra info that isn't required but is useful for testers

  • how a bug was fixed
  • which build the fix will be included in