Skip to content

Instantly share code, notes, and snippets.

@JakeWharton
JakeWharton / OkHttpStack.java
Created May 21, 2013 01:14
A `HttpStack` implementation for Volley that uses OkHttp as its transport.
import com.android.volley.toolbox.HurlStack;
import com.squareup.okhttp.OkHttpClient;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
/**
* An {@link com.android.volley.toolbox.HttpStack HttpStack} implementation which
* uses OkHttp as its transport.
*/
@mike-neck
mike-neck / WebHandlerSpec.groovy
Created August 17, 2012 13:31
Spockこういう書き方もできる
package org.mikeneck.grenail
import spock.lang.Specification
class WebHandlerSpec extends Specification {
def 'initialize test' () {
when :
def handler = init
@mike-neck
mike-neck / pucci.js
Created August 11, 2012 13:35
素数の時にEnrico Pucciと出力するプログラム。
var jojo;
(function () {
jojo = jojo || {};
jojo.bizarre = jojo.bizarre || {};
jojo.bizarre.pucci = function (number, element, maxNumber) {
var base = element || 2,
mod = number % base,
max = maxNumber || (number - mod) / base + 1;
if (base >= max) return true;
if (mod === 0) return false;
@developernotes
developernotes / proguard.cfg
Created July 3, 2012 15:47
ProGuard with SQLCipher for Android
-libraryjars libs/commons-codec.jar
-libraryjars libs/guava-r09.jar
-libraryjars libs/sqlcipher.jar
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers
-dontpreverify
-dontobfuscate
@weidiaoxiang
weidiaoxiang / MainActivity.java
Created June 24, 2012 15:09 — forked from romannurik/SwipeDismissListViewTouchListener.java
**BETA** Android 4.0-style "Swipe to Dismiss" sample code
// THIS IS A BETA! I DON'T RECOMMEND USING IT IN PRODUCTION CODE JUST YET
/*
* Copyright 2012 Roman Nurik
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
@kimukou
kimukou / ActivityUtil.java
Created June 15, 2012 03:47
1.6 verification_error_pass
import java.io.File;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.SharedPreferences.Editor;
@SuppressLint("NewApi")
public class ActivityUtil {
public static void StrictMode11(){
@curioustechizen
curioustechizen / LocalBroadcastReceiver.java
Created May 24, 2012 10:54
Adding ordered broadcast capability to LocalBroadcastManager from Android support library.
package in.curtech.android.common;
import android.content.BroadcastReceiver;
/**
* Extension of {@code BroadcastReceiver} meant to be used in conjunction with
* {@link OrderEnabledLocalBroadcastManager}
*
* @author Kiran Rao
*/
@indare
indare / gist:2699484
Created May 15, 2012 06:06
Closure<php>
<?php
function newCounter(){
$i = 0;
return function() use ($i){
return ++$i;
};
}
//$c = newCounter();
@ecarnevale
ecarnevale / fullscreen-24.diff
Created March 29, 2012 15:03
Add ns-toggle-fullscreen to Emacs 24
diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el
index 084b62f..b7ed1a2 100644
--- a/lisp/term/ns-win.el
+++ b/lisp/term/ns-win.el
@@ -1267,6 +1267,10 @@ the operating system.")
(add-to-list 'window-system-initialization-alist '(ns . ns-initialize-window-system))
+(declare-function ns-toggle-fullscreen-internal "nsfns.m" ())
+(defun ns-toggle-fullscreen ()
@st63jun
st63jun / flymake-java.el
Created March 12, 2012 11:59
Fix flymake+ant problem
;; 素のFlymakeでAntを使うとエラー吐くので,いくつか関数を書き換える必要があるっぽい.
(require 'flymake)
(setq flymake-allowed-file-name-masks
'(("\\.\\(?:c\\(?:pp\\|xx\\|\\+\\+\\)?\\|CC\\)\\'" flymake-simple-make-init)
("\\.xml\\'" flymake-xml-init)
("\\.html?\\'" flymake-xml-init)
("\\.cs\\'" flymake-simple-make-init)
("\\.p[ml]\\'" flymake-perl-init)