Skip to content

Instantly share code, notes, and snippets.

View extralam's full-sized avatar
🎯
Focusing

Alan Lam extralam

🎯
Focusing
View GitHub Profile
@guybedford
guybedford / jquery.ajaxqueue.js
Created April 23, 2012 12:12
jQuery AJAX queues
/*
Allows for ajax requests to be run synchronously in a queue
Usage::
var queue = new $.AjaxQueue();
queue.add({
url: 'url',
/*
* Copyright (C) 2010 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
@fquarters
fquarters / gist:5455460
Last active March 26, 2016 10:17
This plugin is dead simple. It takes your large image and gives you back a proportionally downscaled one as a dataURL object. Works fine in both Chrome and Firefox, not so fine in Opera (‘onload’ event doesn’t fire as it should and I have no idea why, seems to be a “known bug”), and doesn’t work in IE (it may work in IE10 though, but I couldn’t …
var Resizer = function() {
var maxWidth = 0, maxHeight = 0;
var canvas = document.createElement('canvas');
var img = new Image();
var callback;
var isFileOk = function(file) {
if (!file || !file.type.match(/image.*/)) {
return false;
@passsy
passsy / BasicNetwork.java
Created July 8, 2013 09:52
BasicNetwork fix for Volley with fallback to Cache if the device is offline
/*
* Copyright (C) 2011 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
@eveliotc
eveliotc / MyActivityOrFragment.java
Created July 29, 2013 15:38
A variant of https://gist.github.com/eveliotc/6051367 to show a drop shadow, should not be used for performance in mind views
final ImageView imageView = (ImageView) view.findViewById(R.id.image);
final int shadowSize = getResources().getDimensionPixelSize(R.dimen.shadow_size);
final int shadowColor = getResources().getColor(R.color.shadow_color);
imageView.setImageDrawable(new RoundedAvatarDrawable(mBitmap, shadowSize, shadowColor));
if (SDK_INT >= HONEYCOMB) {
imageView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
@FokkeZB
FokkeZB / README.md
Created September 20, 2013 09:38
URL schemes for iOS and Android (2/2)
@plentz
plentz / nginx.conf
Last active May 17, 2024 09:08
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@mikeplate
mikeplate / HttpHelper.java
Created February 23, 2014 15:47
Android very simple HTTP helper class and get method
package se.mobileapplab.lib;
import android.os.AsyncTask;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
/**
@homj
homj / DrawerIconDrawable.java
Last active April 6, 2017 10:11
This Drawable implements the "Drawer-Indicator to Arrow"-Animation as seen in several Material-Design-Apps; NOTE: Mind the updated constructors in Revision 5!
/*
* Copyright 2014 Johannes Homeier
*
* 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
@chriseidhof
chriseidhof / LICENSE
Last active July 16, 2019 13:14
A tiny networking library
Copyright 2015 Chris Eidhof
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.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHE