Skip to content

Instantly share code, notes, and snippets.

@simonheys
simonheys / ArtboardsToXCAssets.jsx
Created September 25, 2014 14:30
Exports each Illustrator artboard as a PDF vector template in the selected XCode Images.xcassets folder
/*
ArtboardsToXCAssets.jsx
Exports each Illustrator artboard as a PDF vector template in the selected XCode Images.xcassets folder
Copyright (c) 2014 Simon Heys <http://www.simonheys.com/>
License: MIT License (MIT) <http://www.opensource.org/licenses/mit-license.php>
*/
var folder = Folder.selectDialog('Select Images.xcassets folder');
@dzolnai
dzolnai / OAuthClient.java
Last active August 18, 2021 07:23
Retrofit OAuth2 refreshing tokens without modifying all requests.
package com.example.yourapp;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import com.example.yourapp.AuthenticationModel;
import retrofit.client.Header;
import retrofit.client.OkClient;
@massie
massie / KryoRegistrator.scala
Created October 29, 2013 23:59
Here's an example of how to embed Avro objects into a Kryo stream. You only need to register each Avro Specific class in the KryoRegistrator using the AvroSerializer class below and you're ready to go.
/*
* Copyright (c) 2013. Regents of the University of California
*
* 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
@jboner
jboner / latency.txt
Last active May 6, 2024 07:06
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@makuk66
makuk66 / rabbitmq-trace-logger.rb
Created August 3, 2011 13:31
simple consumer for rabbitmq firehose; see http://www.rabbitmq.com/firehose.html
#!/home/mqtester/.rvm/wrappers/ruby-1.9.2-p290@mqtester/ruby
# encoding: utf-8
require "rubygems"
require "amqp"
@exchange_name = "amq.rabbitmq.trace"
class Consumer
def handle_message(metadata, payload)
@technoweenie
technoweenie / github_oauth_busy_developer_guide.md
Created May 30, 2010 18:34
GitHub OAuth Busy Developer's Guide

GitHub OAuth Busy Developer's Guide

This is a quick guide to OAuth2 support in GitHub for developers. This is still experimental and could change at any moment. This Gist will serve as a living document until it becomes finalized at Develop.GitHub.com.

OAuth2 is a protocol that lets external apps request authorization to private details in your GitHub account without getting your password. All developers need to register their application before getting started.

Web Application Flow

  • Redirect to this link to request GitHub access: