This file contains hidden or 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
package completable.async; | |
import java.util.Collection; | |
import java.util.List; | |
import java.util.concurrent.*; | |
import static java.util.concurrent.Executors.callable; | |
/** |
This file contains hidden or 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 gh-create-repo | |
if not is_installed http | |
echo "Please install httpie" | |
return 1 | |
end | |
set -l username (git config --global user.name) | |
echo -n "Enter password for $username : " | |
stty -echo |
This file contains hidden or 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 are_installed | |
for cmd in $argv; | |
is_installed $cmd | |
end | |
end |
This file contains hidden or 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 gh-gist | |
if not are_installed http jq | |
echo "Please install httpie and jq" | |
return 1 | |
end | |
set -l username (git config --global user.name) | |
echo -n "Enter password for $username : " | |
stty -echo |
This file contains hidden or 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
package masterspringmvc4.utils; | |
import org.springframework.aop.TargetSource; | |
import org.springframework.aop.framework.Advised; | |
import org.springframework.aop.support.AopUtils; | |
public class ProxyUtils { | |
public static <T> T getProxyTarget(Object proxy) { | |
if (!AopUtils.isAopProxy(proxy)) { | |
throw new IllegalStateException("Target must be a proxy"); |
This file contains hidden or 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
String.prototype.gsub = function (pattern, replacement) { | |
var match, result, source = this.toString(); | |
if (pattern == null || replacement == null) { | |
return source; | |
} | |
result = ''; | |
while (match = source.match(pattern)) { | |
result += source.slice(0, match.index); | |
result += typeof replacement === 'function' ? replacement(match[0]) : replacement; | |
source = source.slice(match.index + match[0].length); |
This file contains hidden or 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
/** | |
* Author: Geoffroy Warin (http://geowarin.github.io) | |
* | |
* Reporter for blanket. Outputs the coverage html to the console. | |
* This is basically a copy of https://github.com/alex-seville/blanket/blob/master/src/qunit/reporter.js | |
* with a few adaptations | |
*/ | |
(function (){ | |
var reporter = function(coverage){ | |
var cssSytle = "#blanket-main {margin:2px;background:#EEE;color:#333;clear:both;font-family:'Helvetica Neue Light', 'HelveticaNeue-Light', 'Helvetica Neue', Calibri, Helvetica, Arial, sans-serif; font-size:17px;} #blanket-main a {color:#333;text-decoration:none;} #blanket-main a:hover {text-decoration:underline;} .blanket {margin:0;padding:5px;clear:both;border-bottom: 1px solid #FFFFFF;} .bl-error {color:red;}.bl-success {color:#5E7D00;} .bl-file{width:auto;} .bl-cl{float:left;} .blanket div.rs {margin-left:50px; width:150px; float:right} .bl-nb {padding-right:10px;} #blanket-main a.bl-logo {color: #EB1764;cursor: pointer;font-weight: bold;text-decoration: none} .bl-source{ overflow-x:scro |
This file contains hidden or 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
@Grapes( | |
@Grab(group = 'org.codehaus.groovy.modules.http-builder', module = 'http-builder', version = '0.7.1') | |
) | |
import groovyx.net.http.RESTClient | |
def etcd = new Etcd() | |
def onSet = { node, previous -> | |
println "set $node" | |
} |
This file contains hidden or 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
#!/usr/bin/env groovy | |
@Grapes( | |
@Grab('log4j:log4j:1.2.17') | |
) | |
import org.apache.log4j.Level | |
import org.apache.log4j.Logger | |
def redirectLog = { Level level -> | |
return { String s -> | |
if (s.trim()) |
This file contains hidden or 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
#!/usr/bin/env groovy | |
import groovy.json.JsonSlurper | |
import groovy.text.SimpleTemplateEngine | |
import org.apache.commons.cli.HelpFormatter | |
def template = new PowerTemplate() | |
template.parseOptions(args) | |
template.run() | |
class PowerTemplate { |