Skip to content

Instantly share code, notes, and snippets.

@eculver
eculver / recursive remove .AppleDouble directories
Created May 26, 2011 00:03
recursive remove .AppleDouble directories
find . -name \.AppleDouble -exec rm -rf {} \;
@davidwkeith
davidwkeith / index.html
Last active April 10, 2024 12:01
NOTE: This was a great hack in days gone by, but now both Apple and Google have improved their support for custom protocol handlers. Licensed under the WFTPL http://www.wtfpl.net/txt/copying/
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>App Redirection</title>
</head>
<body>
<!--
NOTE: This was a great hack in days gone by, but now both Apple and Google have improved their support for custom
protocol handlers.
@pyricau
pyricau / JellyBeanSpanFixTextView.java
Last active October 8, 2021 07:16
A TextView to prevent a bug with spans on JellyBean: http://code.google.com/p/android/issues/detail?id=35466
// Copyright 2012 Pierre-Yves Ricau
//
// 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
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
@romannurik
romannurik / CheatSheet.java
Last active May 16, 2023 13:42
Android helper class for showing cheat sheets (tooltips) for icon-only UI elements on long-press. This is already default platform behavior for icon-only action bar items and tabs. This class provides this behavior for any other such UI element.
/*
* Copyright 2012 Google Inc.
*
* 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
@fiveisprime
fiveisprime / default.js
Created December 19, 2013 15:18
Express router.
var express = require('express')
, routes = require('./server/routes')
, path = require('path')
, app = express();
app.set('port', process.env.PORT || 3000);
app.set('view engine', 'hbs');
app.set('views', path.resolve(__dirname, 'views'));
app.disable('x-powered-by');
@fiveisprime
fiveisprime / app.js
Last active January 3, 2016 05:59
Cloud storage.
var express = require('express')
, formidable = require('formidable')
, fs = require('fs')
, path = require('path')
, app = express()
, storedFiles = [];
//
// Serve the cloud storage contents.
//
@romannurik
romannurik / DrawInsetsFrameLayout.java
Created February 10, 2014 16:28
DrawInsetsFrameLayout — adding additional background protection for system UI chrome when using KitKat’s translucent decor flags.
/*
* Copyright 2014 Google Inc.
*
* 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
@chrisbanes
chrisbanes / ForegroundLinearLayout.java
Created February 19, 2014 13:16
ForegroundLinearLayout
/*
* Copyright (C) 2006 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
@fiveisprime
fiveisprime / transform.js
Last active November 29, 2017 10:40
Replace `_id` with string `id` and remove `__v` when calling `toObject()` in Mongoose.
if (!MySchema.options.toObject) {
PlanSchema.options.toObject = {};
}
MySchema.options.toObject.transform = function(doc, ret) {
// Set the id from the retrun object value which will be a string.
ret.id = ret._id;
delete ret._id;
delete ret.__v;
@chrisbanes
chrisbanes / SystemUiHelper.java
Last active March 2, 2024 18:57
SystemUiHelper
/*
* Copyright (C) 2014 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