Skip to content

Instantly share code, notes, and snippets.

@taylorhughes
taylorhughes / gist:3735840
Created September 17, 2012 06:27 — forked from madrobby/gist:3733875
Fade out to solid color on WebKit and Firefox and IE
<style>
#mask-demo {
background: #d0d0d0;
height: 100px;
width: 500px;
padding: 10px;
position: relative;
overflow: hidden;
}
.fade-right .mask {
import os.path
import json
import logging
from django.conf import settings
from django.contrib.staticfiles.storage import CachedFilesMixin
from storages.backends.s3boto import S3BotoStorage
INDEX_FILENAME = os.path.join(os.path.dirname(__file__), 'static-index.json')
@taylorhughes
taylorhughes / gist:5398956
Created April 16, 2013 19:42
Post-compile "Run Script" build phase for Xcode to add a "radioactive" symbol to your app name when built in debug mode.
INFO_PLIST="$BUILT_PRODUCTS_DIR/$INFOPLIST_PATH"
# Copy from this key to the DisplayName key so we don't have to
# worry about re-reading from the same plist later.
SOURCE_NAME_KEY="CFBundleName"
DISPLAY_NAME_KEY="CFBundleDisplayName"
DISPLAY_NAME=`defaults read $INFO_PLIST $SOURCE_NAME_KEY`
if [ "$CONFIGURATION" = "Debug" ]
then
DEBUG_DISPLAY_NAME="$DISPLAY_NAME ☢"
else
define(['cluster/util'], function(util) {
var PubSub = function() {
this.listeners_ = [];
this.listenersById_ = {};
this.lastId_ = 0;
};
package main
import (
"log"
"net/http"
"net/http/httputil"
"net/url"
"os"
)
### Keybase proof
I hereby claim:
* I am taylorhughes on github.
* I am taylorhughes (https://keybase.io/taylorhughes) on keybase.
* I have a public key whose fingerprint is 7D46 ECF4 DADE BBED 1540 9C79 F40B 2664 6BE8 555D
To claim this, I am signing this object:
@taylorhughes
taylorhughes / uploader.go
Last active July 26, 2022 14:00
A lightly modified excerpt from Cluster's streaming media upload server, which encodes video on the fly as it is uploaded.
func EncodeStreamingVideo(streamingFile io.Reader, request ShouldCanceler) (*os.File, error) {
outputFilename := generateFilename("mp4")
// Actually start the command.
cmd := exec.Command("ffmpeg",
// Read input from stdin.
"-i", "-",
// ... environment-specific ffmpeg options ...
"-y", outputFilename)
//
// ImgixURL.h
// Cluster
//
// Created by Taylor Hughes on 12/18/12.
// Copyright (c) 2012 Taylor Hughes. All rights reserved.
//
#import "NSDictionary+FormEncoded.h"
@taylorhughes
taylorhughes / gist:4dc50b2fe674c0a84cc6
Created October 29, 2014 00:33
Update Facebook token in iOS client from existing server-side cached token
[self.apiClient retrieveConnectedServicesWithSuccessBlock:^(NSDictionary *services) {
NSArray *facebookTokens = services[@"facebook"];
if (facebookTokens.count == 0) {
return;
}
NSDictionary *mostRecentFacebookTokenDict = facebookTokens[0];
NSNumber *refreshTimeNumber = mostRecentFacebookTokenDict[@"refreshTime"];
NSDate *refreshDate = [NSDate dateWithTimeIntervalSince1970:[refreshTimeNumber doubleValue]];
@taylorhughes
taylorhughes / run-worker.sh
Last active March 23, 2022 19:05
Celery example with tasks of varying length + -Ofair
# tested with celery[redis]==3.1.17
# to run with default configuration -- tasks will take 14 seconds to complete the 20 tasks in start_all() below
celery worker -A cluster_project.celery_app -Q tester -lINFO --concurrency=4
# to run with -Ofair -- tasks will take 10 seconds to complete
celery worker -A cluster_project.celery_app -Q tester -lINFO --concurrency=4 -Ofair