This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Save these contents to .git/hooks/pre-commit in your project | |
# folder, and give it executable permissions with | |
# "chmod u+x .git/hooks/pre-commit" | |
# Git will abort a commit if you have non ASCII characters in | |
# the commit, and output the non ASCII characters. | |
output=`git diff HEAD | tr -d "\000-\011\013-\177" | tr -d '\n'` | |
cnt=${#output} | |
if [ -n "$output" ]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Used for measuring performance | |
var clickStartTime; | |
function callbackFunction() { | |
var doneDate = new Date(); | |
var diff = doneDate.getTime() - clickStartTime.getTime(); | |
alert("It took " + diff + " ms"); | |
return false; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var clickStartTime; | |
function timeAction(localThis, actionFunction) { | |
var startTime = new Date(); | |
actionFunction.call(localThis); | |
var endTime = new Date(); | |
alert("Took " + (endTime.getTime() - startTime.getTime()) + " ms to run"); | |
} | |
function callbackFunction() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Some action that triggers generating 10,000 elements | |
function generate10KElements(attachEventDirectly) { | |
var generateFunction = function() { | |
var containerElement = $("#container"); | |
containerElement.html(""); | |
if (!attachEventDirectly) { | |
// This is the magic, all items within the container div that have a CSS class | |
// of sameClassItem get the callbackFunction handler. | |
containerElement.on('click', ".sameClassItem", callbackFunction); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function generate10KRandomClass(attachEventDirectly) { | |
var generateFunction = function() { | |
var containerElement = $("#container"); | |
containerElement.html(""); | |
if (!attachEventDirectly) { | |
// There will be 100 possible classes, call .on for each | |
for (var i=0; i < 100; i++) { | |
containerElement.on('click', ".randomClassItem" + i, callbackFunction); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function generateUniqueClasses(attachEventDirectly, elementsToGenerate) { | |
var generateFunction = function() { | |
var containerElement = $("#container"); | |
containerElement.html(""); | |
for (var i=0; i < elementsToGenerate; i++) { | |
var element = $('<div id="element' + i + '" class="differentClassItem' + i + '"><a href="#">click me</a> </div>'); | |
containerElement.append(element); | |
if (attachEventDirectly) { | |
element.click(callbackFunction); | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object AudaxHealthSoftwareEngineer { | |
val headline = """ | |
Audax Health is hiring! Come join our incredible team of engineers in Washington, DC or San Francisco, | |
to help build the first truly social health platform, Zensey.com. We've embraced Scala and the | |
Lift web framework for most of our software, so if you have experience in or want to learn Scala, | |
we're looking for you! | |
""" | |
val requirementsDescription = """We don't have a firm list of requirements, we're just looking for |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get all current files in your repo of the extensions that you want to be considered code | |
# (.scala and .js for my example) | |
git ls-files | egrep "\.(scala|js)$" > files.txt | |
# Now edit files.txt to remove files that you don't want counted, like jQuery extensions | |
cat files.txt | xargs -n1 git blame -w | ruby -n -e '$_ =~ /^.*\((.*?)\s[\d]{4}/; puts $1.strip' | sort -f | uniq -c | sort -n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get all current files in your repo of the extensions that you want to be considered code | |
# (.scala and .js for my example) | |
git ls-files | egrep "\.(scala|js)$" > files.txt | |
# Now edit files.txt to remove files that you don't want counted, like jQuery extensions | |
cat files.txt | xargs -n1 git blame -w | ruby -n -e '$_ =~ /^.*\((.*?)\s[\d]{4}/; puts $1.strip' | sort -f | uniq -c | sort -n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Disable Rake-environment-task framework detection by uncommenting/setting to false | |
# Warbler.framework_detection = false | |
# Warbler web application assembly configuration file | |
Warbler::Config.new do |config| | |
# Application directories to be included in the webapp. | |
# Add script and db/migrate here | |
config.dirs = %w(app config lib log vendor tmp script db/migrate) | |
# Uncomment this if you're running in 1.9 mode |
OlderNewer