Skip to content

Instantly share code, notes, and snippets.

@rherrmann
rherrmann / DiffLearningTest.java
Last active March 18, 2023 06:29
'Learning Tests' that use the JGit API to diff revisions and create patches: http://www.codeaffine.com/2016/06/16/jgit-diff/
/***************************************************************************************************
* Copyright (c) 2016 Rüdiger Herrmann
* All rights reserved. This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Rüdiger Herrmann - initial API and implementation
**************************************************************************************************/
package com.codeaffine.jgit.example;
@Mariovc
Mariovc / ImagePickerWithCrop.java
Last active April 27, 2022 14:29
[Android] Advanced utility for picking an image from Gallery/Camera with Android Intents (Crop included)
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.content.res.AssetFileDescriptor;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.media.ExifInterface;
@nanpuyue
nanpuyue / youtube-list.sh
Created March 13, 2014 15:00
用于获取youtube播放列表内的所有视频地址
#!/bin/bash
#
# e.g.
# for https://www.youtube.com/playlist?list=PLL7JeXQtCv0MslQgUCV3DvKmaagaB9Nms use:
# youtube-list.sh PLL7JeXQtCv0MslQgUCV3DvKmaagaB9Nms
for i in \
`curl -s "https://www.youtube.com/playlist?list=$1" |\
grep -Po "/watch.*?$1" |\
sed -r "s#&.*##" | uniq`;
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"