Skip to content

Instantly share code, notes, and snippets.

const chunk_while = (input, predicate) =>
input.reduce((accumulator, current, index) =>
index > 0 && predicate(input[index-1], current) &&
[...accumulator.slice(0, accumulator.length-1), [...accumulator[accumulator.length-1], current]] ||
[...accumulator, [current]]
, [])
import { Component } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { Subscription } from 'rxjs/Subscription';
import * as firebase from 'firebase/app';
import { AngularFireAuth } from 'angularfire2/auth';
import { AngularFireStorage } from 'angularfire2/storage';
@Component({
selector: 'app-upload',
templateUrl: './upload.component.html',

Keybase proof

I hereby claim:

  • I am jamesdaniels on github.
  • I am jamesuriah (https://keybase.io/jamesuriah) on keybase.
  • I have a public key ASB-xFm8Id6qWZ6EDQ0BA9srwEy45ZRL3HAbpfFp3JT95wo

To claim this, I am signing this object:

Nov 2 15:12:46 Zurruchno installd[86] <Notice>: 0x16e1bb000 -[MIClientConnection installPath:withOptions:completion:]: Install of "/var/mobile/Media/Downloads/3117124869267619106/-7979392519707096209" type Customer requested by itunesstored (pid 308)
Nov 2 15:12:48 Zurruchno installd[86] <Notice>: 0x16e087000 -[MIInstaller performInstallationWithError:]: Installing <MIInstallableBundle ID=com.client.storegrunt; Version=3.22.00, ShortVersion=3.22.00>
Nov 2 15:12:48 Zurruchno misagent[414] <Notice>: attempt to install invalid profile: 0xe8008012
Nov 2 15:12:48 Zurruchno installd[86] <Error>: 0x16e087000 -[MIInstallableBundle _installEmbeddedProfileInBundle:]: Could not install embedded profile: 0xe8008012 (This provisioning profile cannot be installed on this device.)
Nov 2 15:12:48 Zurruchno installd[86] <Error>: SecTrustEvaluate [leaf IssuerCommonName SubjectCommonName]
Nov 2 15:12:50 Zurruchno installd[86] <Error>: 0x16e087000 +[MICodeSigningVerifier _validateSignatureAndCopyInfoForURL:withOptions:er
/* This is a FluidApp userscript for Google Inbox for Mac.
Includes options for total badge count and unread badge count.
1) You need the paid version of FluidApp (http://fluidapp.com/)
2) Point Fluid to https://inbox.google.com (I recommend the icon from here: https://medium.com/@chrismessina/create-an-icon-for-google-inbox-in-your-dock-ed269312e3bc)
3) Set the user-agent to Chrome
4) Go to window -> userscript and add click the plus sign under the first table (on the left). Name the item 'Inbox'.
5) In the second table (on the right) click the plus and type in "*inbox.google.com*".
6) Paste the contents of this document into the script area below that.
7) Configure badge count (for total or unread only) in the code below.

Keybase proof

I hereby claim:

  • I am jamesdaniels on github.
  • I am jamesuriah (https://keybase.io/jamesuriah) on keybase.
  • I have a public key whose fingerprint is 0A16 8002 F444 EBE3 33C2 6A36 2C95 8E6B A90B 5CE5

To claim this, I am signing this object:

// This will grab the largest image for the pixelRatio without oversampling (iOS style)
// Usage: assetUsingNativePixelRatio('/assets/images', 'logo', 'png', [1,2,3]);
// Output: /assets/images/logo@2x.png
function assetUsingNativePixelRatio(path, name, extension, pixelRatios) {
// Sort the pixelRatios in case they were put in the wrong order
var $pixelRatios = $(pixelRatios).sort();
// Price is right style
var matchingPixelRatio = $pixelRatios.not(function() {
@jamesdaniels
jamesdaniels / login.js
Last active August 29, 2015 14:01
Desk.com fluid scripts
// Pattern *support.appblade.com\/login\/new
$('#user_session_email').val('USERNAME');
$('#user_session_password').val('PASSWORD')[0].form.submit();
# Returns either true or false depending on whether or not the user agent of
# the device making the request is matched to a device in our regex.
def is_mobile_device?
request.user_agent.to_s.downcase =~ /silk|palm|blackberry|nokia|phone|midp|mobi|symbian|chtml|ericsson|minimo|audiovox|motorola|samsung|telit|upg1|windows ce|ucweb|astel|plucker|x320|x240|j2me|sgh|portable|sprint|docomo|kddi|softbank|android|mmp|pdxgw|netfront|xiino|vodafone|portalmmm|sagem|mot-|sie-|ipod|up\\.b|webos|amoi|novarra|cdm|alcatel|pocket|ipad|iphone|mobileexplorer|mobile/
end
# Can check for a specific user agent
# e.g., is_device?('iphone') or is_device?('mobileexplorer')
def is_device?(type)
require "minitest/autorun"
# Usage: IosVersion.new('11A4372q') #=> '7.0b1'
class IosVersion
IOS = {
'7' => [
3, {
'D' => [[1, 2]],
'E' => [[1, 3]],