Skip to content

Instantly share code, notes, and snippets.

View AnalogJ's full-sized avatar
🔥
Why is everything always broken?

Jason Kulatunga AnalogJ

🔥
Why is everything always broken?
View GitHub Profile
@AnalogJ
AnalogJ / generate.js
Last active December 22, 2015 09:49
Chi's map design.
//PHP Pages
<%
id = request["id"];
timestamp = request["timestamp"]
points = Database lookup for points where id = id && timestamp == timestamp
set header content exipry = never
@AnalogJ
AnalogJ / child.txt
Last active December 21, 2015 20:19
please.js snippet
$(function () {
$('.js-close').click(function() {
window.close();
});
please.init(window);
please.defaults({
// reference to the window to send messages to
@AnalogJ
AnalogJ / gist:6315128
Last active December 21, 2015 13:49
Google Signet Gem OAuth2 Example
oauth_client = Signet::OAuth2::Client.new(authorization_uri: 'https://accounts.google.com/o/oauth2/auth', token_credential_uri: 'https://accounts.google.com/o/oauth2/token', client_id: 'CLIENT_ID', client_secret: 'CLIENT_SECRET', redirect_uri: 'urn:ietf:wg:oauth:2.0:oob', scope: 'https://www.googleapis.com/auth/tasks')
oauth_client.authorization_uri
# => #<Addressable::URI:0x1223b74 URI:https://accounts.google.com/o/oauth2/auth?client_id=CLIENT_ID&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code&scope=https://www.googleapis.com/auth/tasks>
oauth_client.update! code: 123456
oauth_client.authorization_uri
# => nil
oauth_client.client_id
# => nil
oauth_client.client_secret
# => nil
@AnalogJ
AnalogJ / DO I LOOK LIKE I GIVE A SHIT PUBLIC LICENSE
Created July 26, 2013 01:17
DO I LOOK LIKE I GIVE A SHIT PUBLIC LICENSE
DO I LOOK LIKE I GIVE A SHIT PUBLIC LICENSE
Version 1, July 2013
Copyright (C) 2013 Sam Levy <sam@samuellevy.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO I LOOK LIKE I GIVE A SHIT PUBLIC LICENSE
@AnalogJ
AnalogJ / gist:6047309
Created July 21, 2013 03:03
AngularJS Dependency Injection for provider.
angular.module('security.authorization', ['security.service'])
// You can add them as resolves to routes to require authorization levels
// before allowing a route change to complete
.provider('securityAuthorization', {
requireUser: ['securityAuthorization', function(securityAuthorization) {
return securityAuthorization.requireUser();
}],
zipstream = require "zipstream"
fs = require "fs"
async = require "async"
class StreamingResponse
filename: ""
files: []
streaming: true
###
// http://www.ietf.org/rfc/rfc1928.txt
// Tested with: curl http://www.google.se/ --socks5 1080 --proxy-user foo:bar
var States = {
CONNECTED:0,
VERIFYING:1,
READY:2,
PROXY: 3
};
@AnalogJ
AnalogJ / gist:2705630
Created May 15, 2012 22:29
Things I'd Like to Open Source Soon (iOS)

Having worked with iOS almost exclusively the past year, there's a few things that I commonly reuse that may be of use to you. If any of this is of interest to you, let me know. I'm trying to prioritize what I'll release first.

  • BBRefreshWebView - A pattern for applying pull-to-refresh functionality to a UIWebView. The goal here is to make it feel as native as possible. Inspired by the Facebook app for iOS.

  • Backlight - Backlight aims to make location tracking more battery-efficient by triggering location tracking only while the user is moving. If an idle period is detected, accurate location tracking is disabled and only re-started if the user moves a significant distance.

  • BBAutoLoadCellView - A way to implement infinite scroll in table views. If the user scrolls to the bottom (or top), a refresh event is triggered and a UIActivityIndicator is displayed.

  • BBChatTableView - iMessage-style chat interface. This is something that I've re-implemented time and time again, there's some tedious aspects that