View ResultSetConvertor.java
import org.json.JSONArray;
import org.json.JSONObject;
import java.sql.ResultSet;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.Locale;
/**
* Utility for converting ResultSets into some Output formats
View simpleHttpServer.py
#!/usr/bin/env python
import SimpleHTTPServer, BaseHTTPServer, SocketServer, socket, time, sys
class ThreadedHTTPServer(SocketServer.ThreadingMixIn,
BaseHTTPServer.HTTPServer) :
"""
New features w/r to BaseHTTPServer.HTTPServer:
- serves multiple requests simultaneously
- catches socket.timeout and socket.error exceptions (raised from
View backup-homebrew.sh
#!/bin/bash
brew_command=/usr/local/bin/brew
brew_cask_command="$brew_command cask"
echo '#!/bin/bash'
echo ''
echo 'trap ctrl_c INT'
echo 'function ctrl_c() {'
echo 'echo "** Trapped CTRL-C"'
View ghostImageAlignment.html
<!--To center an image-->
<p align="center">
![alt]()
</p>
<!--To right align an image-->
<p align="right">
![alt]()
</p>
View docker_cleanup.sh
//remove old unused containers
docker rm -f $(docker ps -a -q)
// remove untagged images
docker rmi $(docker images | grep "^<none>" | awk '{print $3}')
View ohMyZshHistoryCleanUp.regex
: \d+:0;(gd|gst|gaa|ga|gc|irb|git reset|git stash|newzsh|glg|gb|git push|git init|grm|gl|mc|top|git rebase|ember|rake|rackup|git rm|sensors|rails s|tree|ls|ember install|rubocop|reboot|pry|gitg|gitk|man|unity|bower install|npm install|bundle install|bundle update|git pull|node|jekyll|kill|bin\/console|tmux|la|cd ~/code|nvm|fm|ruby).*\n
View checkJiraCustomFieldValueChanged.java
protected boolean fieldWasChanged(String fieldName, IssueEvent issueEvent, String fieldValue) throws GenericEntityException {
boolean result = false;
List<GenericValue> changeItemList = issueEvent.getChangeLog().getRelated("ChildChangeItem");
Iterator<GenericValue> changeItemListIterator = changeItemList.iterator();
while (changeItemListIterator.hasNext()) {
GenericValue changeItem = (GenericValue) changeItemListIterator.next();
String currentFieldName = changeItem.get("field").toString();
if (currentFieldName.equals(fieldName)) // Name of custom field.
View run_es6_code_in_sublime.js
{
"cmd": ["babel-node", "$file"],
"selector": "source.js",
"path": "/usr/local/bin:$PATH", // ENV setting for mac users
"quiet": true // get rid of annoying `[Finished in %fs]`
}
View iban.json
{
"values": [
{
"country": "Albania",
"length": "28",
"code": "AL",
"format": "AL2!n8!n16!c"
},
{
"country": "Andorra",
View csv_to_json.py
import csv
import json
csvfile = open('test.csv', 'r')
jsonfile = open('file.json', 'w')
def lookahead(iterable):
"""Pass through all values from the given iterable, augmented by the
information if there are more values to come after the current one
(True), or if it is the last value (False).