Skip to content

Instantly share code, notes, and snippets.

View mortenjust's full-sized avatar

Morten Just mortenjust

View GitHub Profile
@boyvanamstel
boyvanamstel / gist:989628
Created May 24, 2011 20:47
Resize image in Android
// Source: http://www.anddev.org/resize_and_rotate_image_-_example-t621.html
// load the origial BitMap (500 x 500 px)
Bitmap bitmapOrg = BitmapFactory.decodeResource(getResources(),
R.drawable.android);
int width = bitmapOrg.width();
int height = bitmapOrg.height();
int newWidth = 720;
@demonbane
demonbane / makeapp.sh
Created July 5, 2011 20:05
Create a Fluid-style app launcher for single-window Chrome instances on OSX
#!/bin/sh
echo "What should the Application be called (no spaces allowed e.g. GCal)?"
read inputline
name="$inputline"
echo "What is the url (e.g. https://www.google.com/calendar/render)?"
read inputline
url="$inputline"
@christopherperry
christopherperry / adb+
Created July 30, 2012 16:12
A bash script that let's you issue adb commands to multiple devices at once
#!/bin/bash
# Script adb+
# Usage
# You can run any command adb provides on all your currently connected devices
# ./adb+ <command> is the equivalent of ./adb -s <serial number> <command>
#
# Examples
# ./adb+ version
# ./adb+ install apidemo.apk
# ./adb+ uninstall com.example.android.apis
@uhunkler
uhunkler / SketchLayers.jstalk
Last active September 12, 2016 02:59
SketchLayers - JSTalk Sketch
/**
* SketchLayers - a collection of layer related functions
*
* @type {object}
*/
var SketchLayers =
{
collection : [],
selection : function()
@itsalif
itsalif / SimpleXmlRequest.java
Last active February 25, 2019 16:03 — forked from ficusk/GsonRequest.java
Volley adapter for making XML Requests. It uses Simple-XML for serializing XML to Objects (http://simple.sourceforge.net/). Code is based of GsonRequest. Hope someone finds it useful.
import java.io.UnsupportedEncodingException;
import java.util.Map;
import org.simpleframework.xml.Serializer;
import org.simpleframework.xml.core.Persister;
import com.android.volley.AuthFailureError;
import com.android.volley.NetworkResponse;
import com.android.volley.ParseError;
import com.android.volley.Request;
@hpique
hpique / OSX10.9-notifications.h
Created December 31, 2013 15:13
List of all public notifications in OSX 10.9 (or at least those whose constants are properly named).
// Accounts.framework/Headers/ACAccountStore.h
ACCOUNTS_EXTERN NSString * const ACAccountStoreDidChangeNotification NS_AVAILABLE(10_8, 5_0);
// AddressBook.framework/Headers/ABGlobals.h
extern NSString * const kABDatabaseChangedNotification;
extern NSString * const kABDatabaseChangedExternallyNotification;
// AddressBook.framework/Headers/ABPeoplePickerView.h
extern NSString * const ABPeoplePickerGroupSelectionDidChangeNotification AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
extern NSString * const ABPeoplePickerNameSelectionDidChangeNotification AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
@hubgit
hubgit / netflix-alt-genres.js
Last active May 4, 2016 21:35
1. Sign in to http://movies.netflix.com 2. Open Chrome's Developer Console 3. Paste in the code below and press enter
document.removeChild(document.documentElement);
var table = document.appendChild(document.createElement('table'));
var showData = function(i, title, movies) {
var tr = table.appendChild(document.createElement('tr'));
tr.scrollIntoView();
var th = tr.appendChild(document.createElement('th'));
th.textContent = i;
@zgchurch
zgchurch / BridgingHeader.h
Created June 26, 2014 17:32
Using SQLite3 from Swift
// 1. Create this file in your Xcode project
// 2. Go to "Build Settings" and find "Objective-C Bridging Header." Use the search bar to find it quickly.
// 3. Double-click and type "BridgingHeader.c"
// If you get "Could not import Objective-C Header," try "my-project-name/BridgingHeader.h"
// 4. Go to "Build Phases," "Link Binary With Libraries," and add libsqlite3.0.dylib
#include <sqlite3.h>
@daniellevass
daniellevass / android_material_design_colours.xml
Last active November 30, 2024 02:06
Android Material Design Colours
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- google's material design colours from
http://www.google.com/design/spec/style/color.html#color-ui-color-palette -->
<!--reds-->
<color name="md_red_50">#FFEBEE</color>
<color name="md_red_100">#FFCDD2</color>
<color name="md_red_200">#EF9A9A</color>
@gabrielemariotti
gabrielemariotti / GridActivity.java
Created July 27, 2014 21:38
Android Wear: How to use a simple a GridViewPager with a FragmentGridPagerAdapter.
public class GridActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.grid);
final GridViewPager mGridPager = (GridViewPager) findViewById(R.id.pager);
mGridPager.setAdapter(new SampleGridPagerAdapter(this, getFragmentManager()));
}