Skip to content

Instantly share code, notes, and snippets.

View mntone's full-sized avatar
🏠

monotone mntone

🏠
View GitHub Profile
@borismus
borismus / gist:1032746
Created June 18, 2011 02:46
Convert a base64 string into a binary Uint8 Array
var BASE64_MARKER = ';base64,';
function convertDataURIToBinary(dataURI) {
var base64Index = dataURI.indexOf(BASE64_MARKER) + BASE64_MARKER.length;
var base64 = dataURI.substring(base64Index);
var raw = window.atob(base64);
var rawLength = raw.length;
var array = new Uint8Array(new ArrayBuffer(rawLength));
for(i = 0; i < rawLength; i++) {
@moret
moret / h264-levels.html
Created September 14, 2011 16:34
H.264 Level Calculator
<!DOCTYPE HTML>
<html>
<head>
<title>H.264 Level Calculator</title>
<style>
textarea {
width: 640px;
height: 360px;
}
@gre
gre / easing.js
Last active June 27, 2024 15:37
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* This work is free. You can redistribute it and/or modify it under the
* terms of the Do What The Fuck You Want To Public License, Version 2,
* as published by Sam Hocevar. See the COPYING file for more details.
*/
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {
@grandeforesta
grandeforesta / gist:1938266
Created February 29, 2012 05:42
gitのリビジョン番号をplistに自動的に埋め込む by http://sonson.jp/?p=2241
#svnやgitのリビジョン,ビルド番号をplistに自動的に埋め込む http://sonson.jp/?p=2241
git_revision=$(git show --format='%h' -s)
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$INFOPLIST_FILE")
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$INFOPLIST_FILE"
/usr/libexec/PlistBuddy -c "Set :CFBundleGitRevision $git_revision" "$INFOPLIST_FILE"
@rygorous
rygorous / gist:2156668
Last active June 7, 2024 08:21
float->half variants
// float->half variants.
// by Fabian "ryg" Giesen.
//
// I hereby place this code in the public domain, as per the terms of the
// CC0 license:
//
// https://creativecommons.org/publicdomain/zero/1.0/
//
// float_to_half_full: This is basically the ISPC stdlib code, except
// I preserve the sign of NaNs (any good reason not to?)
@fincs
fincs / main.cpp
Created May 19, 2012 22:37
Fully native C++ WinRT (Metro-style) app
//
// Fully native C++ WinRT application example
// Programmed by fincs
//
#include <windows.h>
#include <roapi.h>
#include <wchar.h>
#include <stdio.h>
#include <stdlib.h>
@kaiix
kaiix / GlossGradientButton.h
Created May 28, 2012 11:55
Gloss gradients button for ios
//
// GlossGradientButton.h
// iOS version of gloss gradients button
// original version for Mac OSX http://cocoawithlove.com/2008/09/drawing-gloss-gradients-in-coregraphics.html
//
#import <UIKit/UIKit.h>
@interface GlossGradientButton : UIButton {
UIColor *buttonColor_;
@rikusalminen
rikusalminen / dot.c
Created July 3, 2012 14:55
SIMD dot products: ARM NEON, SSE3, SSE
#if defined(__ARM_NEON__)
vec4 dot(vec4 a, vec4 b)
{
vec4 prod = vmulq_f32(a, b);
vec4 sum1 = vaddq_f32(prod, vrev64q_f32(prod));
vec4 sum2 = vaddq_f32(sum1, vcombine_f32(vget_high_f32(sum1), vget_low_f32(sum1)));
return sum2;
}
#else if defined(__SSE3__)
static inline vec4 vdot(vec4 x, vec4 y)
@Jxck
Jxck / rest_and_websocket
Created August 20, 2012 10:30
REST と WebSocket
# REST と WebSocket
t_wada さんとちょっと話す機会があったので、ここまでに考えてたことを一旦まとめて見たいと思う。
REST については、「Web を支える技術」でお茶を濁さず、本家論文なども参照されたし。
## REST
REST はプロトコルでもアーキテクチャでもなく、アーキテクチャスタイルです。
そこにはいくつかの原則があり、最も重要な原則の一つにステートレス性があります。
@0mg
0mg / twoauth.md
Created March 30, 2013 14:32
OAuth 対応 Twitter クライアント作成メモ

OAuth 対応 Twitter クライアント作成メモ

  • 前提: OAuth version 1.0a, Twitter API 1.1

OAuth 認証を通じてツイートするのに必要なたった 1 つのこと

リクエストヘッダに Authorization フィールドをセットする

OAuth 認証を通じてツイートするためには、API に対して POST する際、リクエストヘッダに Authorization フィールドを含める必要がある。