This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
afterEvaluate { project -> | |
android.applicationVariants.each { variant -> | |
variant.javaCompile.dependsOn stripPlayServices | |
} | |
} | |
task stripPlayServices << { | |
def explodedDir = project.tasks.findAll { it.name.startsWith("prepare") && it.name.endsWith("Library")}.iterator().next().explodedDir.getParentFile().getParentFile().getParentFile() | |
def playServiceRootFolder = new File(explodedDir, "com.google.android.gms/play-services/") | |
playServiceRootFolder.list().each { versionName -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.Context; | |
import android.util.AttributeSet; | |
import android.widget.ImageView; | |
/** | |
* Thanks to StackOverflow | |
* @link http://stackoverflow.com/a/15264039/425050 | |
*/ | |
public class SquareImageView extends ImageView { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
xmlns:ads="http://schemas.android.com/apk/res-auto" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:gravity="center_horizontal" | |
android:orientation="vertical"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
repo forall -c ' | |
if git rev-parse android-4.0.3_r1 >/dev/null 2>&1 | |
then | |
git log --oneline --no-merges android-4.0.3_r1..android-4.0.4_r1.1 | |
else | |
git log --oneline --no-merges android-4.0.4_r1.1 | |
fi | |
' | cat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Jekyll | |
class GooglePlusEmbedTag < Liquid::Tag | |
@post = nil | |
@height = '' | |
@width = '' | |
def initialize(tag_name, markup, tokens) | |
if markup =~ /(https:\/\/plus.google.com\/\d+\/posts\/\w+)/i | |
@url = $1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# Connects to servers vulnerable to CVE-2014-0160 and looks for cookies, specifically user sessions. | |
# Michael Davis (mike.philip.davis@gmail.com) | |
# Based almost entirely on the quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org) | |
# The author disclaims copyright to this source code. | |
import select |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A man flying in a hot air balloon suddenly realizes he’s lost. He reduces height and spots a man down below. He lowers the balloon further and shouts to get directions, "Excuse me, can you tell me where I am?" | |
The man below says: "Yes. You're in a hot air balloon, hovering 30 feet above this field." | |
"You must work in Information Technology," says the balloonist. | |
"I do" replies the man. "How did you know?" | |
"Well," says the balloonist, "everything you have told me is technically correct, but It's of no use to anyone." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Colors | |
def colorize(text, color_code) | |
"\033[#{color_code}m#{text}\033[0m" | |
end | |
{ | |
:black => 30, | |
:red => 31, | |
:green => 32, | |
:yellow => 33, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* From a file that contains | |
* doc_id w1 w2 w3 ... lines, separated by tabs | |
* return an inverted index Map of w -> Set(doc_id) | |
* | |
* @param filename well isn't it obvious | |
* @return Map[String,Set[String]] | |
*/ | |
import scala.collection.immutable.Map |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'digest/sha1' | |
class Miner | |
attr_reader :tree, :parent, :timestamp | |
def initialize | |
@tree=`git write-tree`.chomp | |
@parent=`git rev-parse HEAD`.chomp | |
@timestamp=12345 | |
end | |