Skip to content

Instantly share code, notes, and snippets.

package fm.setlist.client;
import java.net.URL;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Unmarshaller;
import fm.setlist.api.model.Setlist;
public class Test {
@jasonwaters
jasonwaters / contains.html
Last active December 23, 2015 12:09
javascript contains method
<html>
<body>
<script type="text/javascript">
Object.prototype.contains = function(value) {
for(key in this) {
if(this.hasOwnProperty(key) && this[key] == value) {
return true;
}
}
return false;
@jasonwaters
jasonwaters / gist:9820048
Created March 27, 2014 22:03
search indexer error
DEBUG [Bulk Consumer - Thread3] 27 Mar 2014 15:51:14:351 [SearchIndexerBulkConsumer.processMessage()]: customerID: 53347016000000211bc8fb1d9b0c9e51
ERROR [Bulk Consumer - Thread3] 27 Mar 2014 15:51:14:363 [SearchIndexerBulkConsumer.onMessage()]: error processing message
com.attask.sdk.api.APIException: You are not currently logged in
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.codehaus.jackson.map.introspect.AnnotatedConstructor.call1(AnnotatedConstructor.java:109)
at org.codehaus.jackson.map.deser.std.StdValueInstantiator.createFromString(StdValueInstantiator.java:263)
at org.codehaus.jackson.map.deser.std.ThrowableDeserializer.deserializeFromObject(ThrowableDeserializer.java:150)
(function() {
var jq = document.createElement('script');
jq.src = "https://code.jquery.com/jquery-latest.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
setTimeout(function() {
var totes = 0;
$('#result_list>tbody tr').each(function() {
var value = parseFloat($(this).find('td:nth-child(3)').text());
if (!isNaN(value)) {
# Copyright (c) 2010 AtTask, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
# Software.
#
@jasonwaters
jasonwaters / droneDeploy.js
Created July 11, 2016 04:57
Drone Deploy Coding Exercise
// Below is a drone object with six methods.
// Each method takes a callback and after some amount of time will execute that callback (for ease of testing, it will also console.log a value).
// At the bottom of the page the expected output is logged.
// And we invoke the chained call of the drone object. However the drone object does not yet have a chained api.
// Your job is to add a chained api to the drone object by only modifying the code in the middle of the page.
// A good answer should include the following criteria.
// 1. Code was only added between the below comments.
// 2. Each method in the chain executes only after the previous method has resolved
@jasonwaters
jasonwaters / index.html
Created September 9, 2016 23:12
Jason's Template Renderer
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div id="output"></div>
<hr/>
<form id="myForm">
<input placeholder="Name&hellip;" type="text" id="myName"/>
<input placeholder="Number&hellip;" type="number" id="myNumber"/>
@jasonwaters
jasonwaters / deferImages.html
Created September 9, 2016 23:35
Jason's defer images solution
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.js"></script>
</head>
<body>
<p><img src="https://securecdn.disqus.com/uploads/mediaembed/images/509/9511/original.jpg?w=128"></p>
<p><img src="https://securecdn.disqus.com/uploads/mediaembed/images/509/9512/original.jpg?w=128"></p>
<p><img src="https://securecdn.disqus.com/uploads/mediaembed/images/509/9513/original.jpg?w=128"></p>
<p><img src="https://securecdn.disqus.com/uploads/mediaembed/images/509/9514/original.jpg?w=128"></p>
var a = [1, {a: [2, [3]]}, 'four', [[5], [6]], [[7], 8, 9], 10];
function flatten(arr) {
let idx = 0;
while(idx < arr.length) {
if(arr[idx] instanceof Array) {
Array.prototype.splice.apply(arr, [idx, 1].concat(arr[idx]));
}else {
function findSqRt(target) {
var upper = target,
lower = 0,
square=0,
value=0;
while(Math.abs(target-square) >= 0.00000001) {
value = (upper + lower) /2;
square = value * value;