Skip to content

Instantly share code, notes, and snippets.

View JeffML's full-sized avatar
🏠
Barely working

Jeff Lowery JeffML

🏠
Barely working
View GitHub Profile
@robfletcher
robfletcher / gist:1486156
Created December 16, 2011 14:06
Geb module methods demonstrating how to wait for jQuery animation to complete
void next() {
nextButton.click()
waitForAnimationComplete()
}
private void waitForAnimationComplete() {
waitFor {
js.exec(this.firstElement(), "return \$(arguments[0]).find(':animated').length == 0")
}
}
@esycat
esycat / PrettyPrinter.groovy
Last active June 11, 2024 12:18
A simple way to pretty print nested lists and maps in Groovy.
import static groovy.json.JsonOutput.*
def config = ['test': 'lalala']
println prettyPrint(toJson(config))
@n00neimp0rtant
n00neimp0rtant / gist:9515611
Last active March 14, 2024 06:30
simple squash without rebase
## within current branch, squashes all commits that are ahead of master down into one
## useful if you merged with upstream in the middle of your commits (rebase could get very ugly if this is the case)
## commit any working changes on branch "mybranchname", then...
git checkout master
git checkout -b mybranchname_temp
git merge --squash mybranchname
git commit -am "Message describing all squashed commits"
git branch -m mybranchname mybranchname_unsquashed
git branch -m mybranchname
@chuckreynolds
chuckreynolds / stopwatch.php
Created July 27, 2016 22:56
Simple "StopWatch" class to measure PHP execution time. The class can handle multiple separate timers at the same time
<?php
class StopWatch {
/**
* @var $startTimes array The start times of the StopWatches
*/
private static $startTimes = array();
/**
* Start the timer
*
@hyamamoto
hyamamoto / string.hashcode.js
Created September 30, 2016 07:19
JavaScript Implementation of String.hashCode() .
/**
* Returns a hash code for a string.
* (Compatible to Java's String.hashCode())
*
* The hash code for a string object is computed as
* s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1]
* using number arithmetic, where s[i] is the i th character
* of the given string, n is the length of the string,
* and ^ indicates exponentiation.
* (The hash value of the empty string is zero.)