Skip to content

Instantly share code, notes, and snippets.

@briscula
briscula / DOWNSIZE.md
Last active August 29, 2015 14:06 — forked from FokkeZB/DOWNSIZE.md
// Taken from the commercial iOS PDF framework http://pspdfkit.com.
// Copyright (c) 2014 Peter Steinberger, PSPDFKit GmbH. All rights reserved.
// Licensed under MIT (http://opensource.org/licenses/MIT)
//
// You should only use this in debug builds. It doesn't use private API, but I wouldn't ship it.
#import <objc/runtime.h>
#import <objc/message.h>
// Compile-time selector checks.
/*Sign up for the Bing Translator, 2million characters/month of free translating!*/
%let client_id=<<Your Client ID>>;
%let client_secret=<<Your Client Secret>>;
%let text=Merry Christmas;
%let from=en; /*English*/
%let to=es; /*Spanish*/
/*Link to language codes: http://msdn.microsoft.com/en-us/library/hh456380.aspx*/
filename ivy "%sysfunc(pathname(work,l))/ivy.jar";
import org.codehaus.groovy.grails.plugins.codecs.Base64Codec
class PlistUtility {
static parseXmlPlistText(String text) {
def xml = new XmlParser().parseText(text)
assert xml.name() == "plist"
def parseNode
parseNode = { node ->
@briscula
briscula / fix-xcode
Last active August 29, 2015 14:20 — forked from rnapier/fix-xcode
#!/usr/bin/python
# fix-xcode
# Rob Napier <[email protected]>
# Script to link in all your old SDKs every time you upgrade Xcode
# Create a directory called /SDKs (or modify source_path).
# Under it, put all the platform directories:
# MacOSX.platform iPhoneOS.platform iPhoneSimulator.platform
# Under those, store the SDKs:
@briscula
briscula / SimpleXmlRequest.java
Created October 20, 2015 10:48 — forked from itsalif/SimpleXmlRequest.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;
@briscula
briscula / RssRequest.java
Created October 20, 2015 10:49 — forked from omarmiatello/RssRequest.java
RssRequest for Volley (Android lib)
/**
* Copyright 2013 Omar Miatello - [email protected]
*
* 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
@briscula
briscula / resize_icons.rb
Created January 14, 2016 12:03 — forked from meng-hui/resize_icons.rb
Populate a Unity generated Xcode project with all icons for a Universal build from a single icon file. In the folder with the xcode project, execute this script and by default looks for a file named icon_1024x1024.png and places all the icons needed into Unity-iPhone/Images.xcassets/AppIcon.appiconset/ . Requires gd and fastimage_resize gem
#!/usr/bin/env ruby
# make sure you have gd and fastimage_resize
# brew install gd
# sudo gem install fastimage_resize
require 'fastimage_resize'
require 'optparse'
require 'json'
require 'fileutils'
@briscula
briscula / container.js
Created March 3, 2016 21:52 — forked from mixersoft/container.js
Add downloadContainer to the loopback-component-storage REST API and use node-archiver to archive from downloadStream()
'use strict';
/**
* @ngdoc function
* @name loopback-component-storage:container
* @description Add remote hooks for Model:container
npm install archiver lodash --save
*/
@briscula
briscula / EnhancedMenuInflater.java
Created March 11, 2016 20:02 — forked from dodgex/EnhancedMenuInflater.java
splitActionBar for Android 5.0
import android.support.v4.internal.view.SupportMenuItem;
import android.support.v7.internal.view.menu.MenuItemImpl;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import here.is.your.R;
public class EnhancedMenuInflater {