Skip to content

Instantly share code, notes, and snippets.

@hayeshaugen
hayeshaugen / gist:994453
Created May 27, 2011 01:07
Android SDK headless install for Linux Jenkins CI
# sudo su -
# apt-get install openjdk-6-jdk
# apt-get install ant1.8
Source control, in this case svn:
# apt-get install subversion
Install Jenkins
@bverc
bverc / CountDownTimer.java
Created December 18, 2011 07:49 — forked from Gautier/CountDownTimer.java
Drop-in alternative for the Android CountDownTimer class, but which you can cancel from within onTick. Modified to include pause and resume functionality.
/*
* Copyright (C) 2008 The Android Open Source Project
*
* 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
*
* Unless required by applicable law or agreed to in writing, software
@j4mie
j4mie / gist:1778918
Created February 9, 2012 09:46
# How to run Sentry in a subdirectory (http://your.server.com/sentry/) with nginx

How to run Sentry in a subdirectory with nginx

Scenario: you already have an app running at http://your.server.com/ and you want to run Sentry at http://your.server.com/sentry/

I spend a few hours banging my head against this, and finally got it to work. There may be a better way, but I couldn't find it.

Warning: hacky.

nginx.conf (in server stanza)

@lmacken
lmacken / linkify.py
Created February 21, 2012 19:04
linkify.py - Turns URLs into links
#!/usr/bin/env python
# linkify.py - Turns URLs into links.
#
# Using on a file:
#
# $ linkify.py <filename>
# <a href="http://lewk.org">http://lewk.org</a>
#
# Using within a pipeline:
#
@ibeex
ibeex / foo.log
Created August 4, 2012 13:46
Flask logging example
A warning occurred (42 apples)
An error occurred
@papoms
papoms / change-referrer.demo.phantom.js
Created August 26, 2012 17:03
Try to overwrite window.document.referrer from within phantomjs / onInitialized
var page = require('webpage').create();
page.onConsoleMessage = function (msg) {
console.log('From Page Console: '+msg);
};
page.onInitialized = function() {
page.evaluate(function () {
"use strict";
//The Referrer we want to set
@arriolac
arriolac / TopCropImageView.java
Last active March 21, 2023 08:01
Custom Android ImageView for top-crop scaling of the contained drawable.
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Matrix;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.ImageView;
/**
* Created by chris on 7/27/16.
@lost-theory
lost-theory / gist:3928813
Created October 21, 2012 22:48
flask dynamic url_prefix for blueprints
from flask import Flask, Blueprint, request
## blueprint ##################################################################
bp = Blueprint('category_functionality', __name__)
@bp.route('/')
def index(category):
return "this is the index page for %r" % category
@jaredhirsch
jaredhirsch / gist:4971859
Created February 17, 2013 15:19
all about ETags

ETags: a pretty sweet feature of HTTP 1.1

HTTP caching review

HTTP provides two ways for servers to control client-side caching of page components:

  • freshness may be based on a date or a token whose meaning is app-specific
  • whether or not the client needs to confirm the cached version is up-to-date with the server

This breaks down as follows:

  • Cache locally and don't check before using.
@emil2k
emil2k / Connectivity.java
Last active December 22, 2023 06:03
Android utility class for checking device's network connectivity and speed.
/*
* Copyright (c) 2017 Emil Davtyan
*
* 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: