Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am tonyxiao on github.
  • I am tonyx (https://keybase.io/tonyx) on keybase.
  • I have a public key whose fingerprint is C754 3E03 15B7 33C6 1C3B E4BC 8A3A 3627 015F 2E03

To claim this, I am signing this object:

@tonyxiao
tonyxiao / Analytics.podspec
Created February 22, 2014 20:09
Analytics Selective Podspec
Pod::Spec.new do |s|
s.name = "Analytics"
s.version = "0.9.9.fork"
s.summary = "Segment.io analytics and marketing tools library for iOS."
s.homepage = "https://segment.io/libraries/ios"
s.license = { :type => "MIT", :file => "License.md" }
s.author = { "Segment.io" => "friends@segment.io" }
s.platform = :ios, '6.0'
s.source = { :git => "https://github.com/segmentio/analytics-ios.git", :commit => "06e96dbdb6bdd4b640c584bda2107c53cfd07fdb" }
s.requires_arc = true
#!/usr/bin/env python
from urlparse import urlparse, parse_qs
import urllib2
import plistlib
import webbrowser
print 'Enter url copied from Crashlytics Beta iOS webpage'
print 'Should look like itms-services://?action=download-manifest&url=https%3A%2F%2Fapps.crashlytics.com%2Fprojects...'
itms_url = raw_input('Enter item-services url: ')
result = urlparse(itms_url)
# Uncrustify 0.59
#
# General options
#
# The type of line endings
newlines = auto # auto/lf/crlf/cr
# The original size of tabs in the input
//
// VideoView.m
// MacVideoWall
//
// Created by David Rönnqvist on 9/28/13.
// This is the source code behind the Mac Video Wall that I was trying to port to iOS in [this Stack Overflow question](http://stackoverflow.com/questions/19065816/ios-alternative-to-qtmovielayer-that-has-non-nil-contents)
//
#import "VideoView.h"
! function(e, n) {
var t = n();
"function" == typeof define && define.amd ? define([], t.getInstance()) : "object" == typeof exports ? (module.exports = t.getInstance(), module.exports.SB = t, module.exports.sendbird = t.getInstance()) : (e.SB = t, e.sendbird = t.getInstance())
}(this, function() {
function e() {
try {
if ("undefined" == typeof navigator || "undefined" == typeof navigator.userAgent) return !1;
var e = navigator.userAgent.toLowerCase();
return -1 != e.indexOf("msie") ? parseInt(e.split("msie")[1]) : !1
} catch (n) {
@tonyxiao
tonyxiao / router.js
Created September 9, 2016 05:26
GraphQL authentication
router.post('/graphql', (ctx) => {
return apolloKoa({
schema: executableSchema,
context: {
headers: ctx.request.headers,
},
printErrors: true,
})(ctx)
})
@tonyxiao
tonyxiao / docheadRoutes.jsx
Created March 10, 2016 23:00
Inject custom dochead into html returned by meteor server. Credit goes to https://github.com/thereactivestack/meteor-react-router-ssr
import React from 'react'
import {IndexRoute, Route} from 'react-router'
import Helmet from 'react-helmet'
const wrap = (Component) => (location, cb) => {
cb(null, Component)
}
const makeHelmet = (info) => {
const {title, description, image, url} = {
@tonyxiao
tonyxiao / spec.json
Last active April 13, 2021 23:29
stack bar with rule (Vega-Lite spec from Tue Apr 13 2021)
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"width": 500,
"layer": [
{
"mark": {"type": "bar", "tooltip": true},
"encoding": {
"color": {"field": "supertype"},
"y": {"field": "sum", "type": "quantitative", "scale": {"padding": 1}},
"x": {
// @ts-check
const lodash = require('lodash')
const addrs = require('email-addresses')
/**
*
* @param {*} lib
* @param {string} email Used for last update key
* @param {boolean} reset Whether to clear the key