Skip to content

Instantly share code, notes, and snippets.

@johnboker
johnboker / example.html
Last active April 21, 2016 13:42
jquery.blink.js example
<html>
<head>
<script src="https://code.jquery.com/jquery-2.2.3.min.js"></script>
<script src="jquery.blink.js"></script>
<script>
$(document).ready(function() {
$('.blink').blink({delay: 200});
});
@johnboker
johnboker / WebService.java
Created July 14, 2015 19:26
Web Service generic json call with volley and gson.
import com.android.volley.AuthFailureError;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import java.util.HashMap;
import java.util.Map;
@johnboker
johnboker / IWebServiceCallback.java
Created July 16, 2015 13:01
IWebServiceCallback.java
public interface IWebServiceCallback<T> {
void onResponse(T response);
void onErrorResponse();
}
@johnboker
johnboker / Backoff.java
Created August 4, 2015 18:12
Schedule a pending intent in android.
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.os.SystemClock;
import android.util.Log;
public class Backoff
{
private static String TAG = "Backoff";
using System;
using System.Linq;
namespace AdventOfCodeDay1
{
class MainClass
{
public static void Main (string[] args)
{
var input = "(((())))()((((((((())()(()))(()((((()(()(((()((()((()(()()()()()))(((()(()((((((((((())(()()((())()(((())))()(()(()((()(()))(()()()()((()((()(((()()(((((((()()())()((((()()(((((()(())()(())((())()()))()(((((((())(()())(()(((())(()))((())))(()((()())))()())((((())))(()(((((()(())(((()()((()((()((((((((((())(()())))))()))())()()((((()()()()()()((((((())())(((()())()((()()(((()()()))(((((()))(((()(()()()(()(()(((())()))(()(((()((())()(()())())))((()()()(()()(((()))(((()((((()(((((()()(()())((()())())(()((((((()(()()))((((()))))())((())()()((()(()))))((((((((()))(()()(((())())(())()((()()()()((()((()((()()(((())))(()((())()((((((((()((()(()()(((())())())))(())())))()((((()))))))())))()()))()())((()())()((()()()))(()()(((()(())((((())())((((((((()()()()())))()()()((((()()))))))()((((()(((()))(()()())))((()()(((()))()()())())(((())((()()(())()()()(((())))))()())((()))()))(
var paperNeeded = input.Select(a => new
{
SurfaceArea = 2 * a.Item1 * a.Item2 + 2 * a.Item1 * a.Item3 + 2 * a.Item2 * a.Item3,
Extra = Math.Min(Math.Min(a.Item1 * a.Item2, a.Item1 * a.Item3), a.Item2 * a.Item3)
}).Sum(b => b.SurfaceArea + b.Extra);
var ribbonNeeded = input.Select(a => new
{
Permiter = Math.Min(Math.Min(2 * (a.Item1 + a.Item3), 2 * (a.Item2 + a.Item3)), 2 * (a.Item2 + a.Item1)),
Extra = a.Item1 * a.Item2 * a.Item3
// part 1
var input = "<input here>";
var visited = new List<Point> { new Point(0, 0) };
var x = 0;
var y = 0;
foreach (var d in input)
using System;
using System.Security.Cryptography;
using System.Text;
namespace AdventOfCodeDay4
{
class Program
{
static void Main()
{
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
namespace AdventOfCodeDay5
{
class MainClass
{
public static void Main (string[] args)
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Drawing;
using System.Drawing.Imaging;
namespace AdventOfCodeDay6
{