// jQuery
$(document).ready(function() {
// code
})
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
/** | |
* A thread-safe lazy object reference that will only initialize its value when get() is called. | |
*/ | |
public abstract class Lazy<T> { | |
private volatile T object; | |
private volatile boolean initialized; | |
@JsonValue | |
public T get() { | |
T result = object; |
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
import org.apache.log4j.*; | |
public class LogClass { | |
private static org.apache.log4j.Logger log = Logger.getLogger(LogClass.class); | |
public static void main(String[] args) { | |
log.setLevel(Level.WARN); | |
log.trace("Trace Message!"); | |
log.debug("Debug Message!"); |
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
class Version { | |
Integer major; | |
Integer minor; | |
Integer patch; | |
Version(major, minor, patch) { | |
this.major = major | |
this.minor = minor | |
this.patch = patch | |
} |
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
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.function.Supplier; | |
@SuppressWarnings("unused") | |
public class Scenario<T> { | |
private State state; | |
private final String description; | |
private final Supplier<T> contextSupplier; |
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
import android.support.annotation.NonNull; | |
import com.annimon.stream.function.Consumer; | |
import rx.Observable; | |
import rx.Scheduler; | |
import rx.Subscriber; | |
import rx.Subscription; | |
public class RetroObservable<T> { |
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
public class Format { | |
public static String format(String source, String ... args) { | |
return String.format(source.replaceAll("\\$\\w+", "%s"), (Object[]) args); | |
} | |
} |
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
public static <T> Optional<T> resolve(Supplier<T> resolver) { | |
try { | |
T result = resolver.get(); | |
return Optional.ofNullable(result); | |
} catch (NullPointerException e) { | |
return Optional.empty(); | |
} | |
} |
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
public static Set<String> getNamedGroupCandidates(String regex) { | |
Set<String> namedGroups = new TreeSet<>(); | |
Matcher m = Pattern.compile("\\(\\?<([a-zA-Z0-9]*)>").matcher(regex); | |
while (m.find()) { | |
namedGroups.add(m.group(1)); | |
} | |
return namedGroups; | |
} |
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
from django import template | |
register = template.Library() | |
@register.tag(name="raw") | |
def raw(parser, token): | |
# Whatever is between {% raw %} and {% endraw %} will be preserved as | |
# raw, unrendered template code. | |
text = [] |
NewerOlder