Skip to content

Instantly share code, notes, and snippets.

@HenrikJoreteg
HenrikJoreteg / straight_include.py
Created December 15, 2010 16:06
A Django Template tag for including files that you don't want to parse as templates
"""
Straight Include template tag by @HenrikJoreteg
Django templates don't give us any way to escape template tags.
So if you ever need to include client side templates for ICanHaz.js (or anything else that
may confuse django's templating engine) You can is this little snippet.
Just use it as you would a normal {% include %} tag. It just won't process the included text.
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@jpf
jpf / copy-paste.sh
Created October 28, 2012 00:09
Copy files between hosts using only copy and paste
# clear your terminal scroll buffer (Cmd-K on Mac OS X)
remote-host$ tar czf - * | uuencode file.tgz
# copy all the output
local-host$ cat > uu
# paste
# Ctrl+D
## On Mac OSX you can use "pbpaste > uu"
local-host$ uudecode uu
local-host$ tar xzf file.tgz
## I've actually used this in production.
@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
@joshdholtz
joshdholtz / SomeFragment.java
Last active December 22, 2022 09:41
Android Google Maps V2 - MapView in XML
public class SomeFragment extends Fragment {
MapView mapView;
GoogleMap map;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.some_layout, container, false);
@jpeddicord
jpeddicord / build.gradle
Last active April 14, 2023 20:31
Release APK builder that asks for your key passwords interactively, so you don't have to store them in your build script or VCS. For use with the Gradle build system. CC0 license.
// additional required configuration to hook into the build script
android {
signingConfigs {
release
}
buildTypes {
release {
signingConfig signingConfigs.release
}
@oginorasta
oginorasta / Intellij Shortcut list
Last active October 28, 2022 08:45
All the shortcuts I know and use in Intellij Idea resp. Android Studio. v 1.0
Strg Alt Shift Key Function
x Einf Generate/Insert dialog
x x ENTER Statements completion like blocks and brackets
x x T Surrond codeblock with…
x W Select succesively increasing code blocks
x F11 bookmarks and mark the line with selected key
x F11 invokes a list of bookmarks. Pressing a key takes to associated bookmark.
x x Backspace go to most recent code edit. Hit again to go even further back.
x E recent opened files
x x E recent edited files
@kovpas
kovpas / 30-income-calculon.pl
Last active January 16, 2018 14:56 — forked from avar/30-income-calculon.pl
Calculate your income in The Netherlands with and without a 30% ruling
# To check if this is up-to-date with the tax rates go to
# http://www.expatax.nl/tax_rates_2013.php and see if there's anything
# newer there.
use strict;
use warnings;
use Text::TabularDisplay;
use List::Util qw(sum);
my $start = 30_000 || $ARGV[0];
my $end = 100_000 || $ARGV[1];
@alexjlockwood
alexjlockwood / MainActivity.java
Last active August 12, 2020 12:06
Sample usage of the "android.app.Application.ActivityLifecycleCallbacks" class.
public class MainActivity extends Activity {
private final MyActivityLifecycleCallbacks mCallbacks = new MyActivityLifecycleCallbacks();
@Override
protected void onCreate(Bundle savedInstanceState) {
// Always register before calling into the super class.
getApplication().registerActivityLifecycleCallbacks(mCallbacks);
super.onCreate(savedInstanceState);
@nicolasjafelle
nicolasjafelle / SafeAsyncTask.java
Last active February 16, 2017 12:36
SafeAsyncTask taken from Roboguice 2.0. and adapted to work without roboguice. Simple copy and paste this class and follow the javadoc.
package com.asynctask.util;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import java.io.InterruptedIOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.concurrent.Callable;