Skip to content

Instantly share code, notes, and snippets.

#import <AudioToolbox/AudioServices.h>
// getting system volume
+(float)volume
{
Float32 outputVolume;
UInt32 propertySize = 0;
OSStatus status = noErr;
@uasi
uasi / vim.rb
Created November 30, 2010 16:46
Vim formula for Homebrew (EDIT: recent versions of official Homebrew distribution includes one)
require 'formula'
class Vim < Formula
homepage 'http://www.vim.org/'
url 'ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2'
head 'https://vim.googlecode.com/hg/'
sha256 '5c5d5d6e07f1bbc49b6fe3906ff8a7e39b049928b68195b38e3e3d347100221d'
version '7.3.682'
def features; %w(tiny small normal big huge) end
@yaotti
yaotti / anything-git-project.el
Created December 15, 2010 03:26
List up all files under the control of git and do something (open/view/delete/etc) with them
(defun anything-c-sources-git-project-for (pwd)
(loop for elt in
'(("Modified files (%s)" . "--modified")
("Untracked files (%s)" . "--others --exclude-standard")
("All controlled files in this project (%s)" . ""))
collect
`((name . ,(format (car elt) pwd))
(init . (lambda ()
(unless (and ,(string= (cdr elt) "") ;update candidate buffer every time except for that of all project files
(anything-candidate-buffer))
@uasi
uasi / Localizable.strings
Created October 9, 2011 08:19
Alternative Japanese localization for Growl 1.3.1
/* No comment provided by engineer. */
"Alert! Enabling this option will add Growl.app to your login items" = "注意!このオプションをオンにすると Growl がログイン項目に追加されます";
/* No comment provided by engineer. */
"Allowing this will let Growl launch everytime you login, so that it is available for applications which use it at all times" = "ログイン時に Growl を起動し、すべてのアプリケーションから使えるようにする";
/* No comment provided by engineer. */
"Application: %@\nTitle: %@\nDescription: %@\nClick to open the log" = "アプリケーション: %1$@\nタイトル: %2$@\n説明: %3$@\nクリックしてログを開く";
/* No comment provided by engineer. */
@mala
mala / gist:5268998
Last active December 15, 2015 13:39
データをpostMessageで受け渡すセッション限りのトークン取得(取得しない)フロー

一瞬popup + 以降iframeでproxyするようなもの。XHR level2いらないのでやや動作環境が広がる。

  • クライアント側ボタンクリックで window.open + ランダムなid(これをclient_id相当にする)の名前をつけてiframe埋め込み
  • popup windowにiframeの名前をpostMessageで送る
  • サーバー側: popup windowはiframeに対してpostMessageで返信(event.source.frames.xxxx)、api-domainのoriginであることを確認、cookieで認証してランダムなidとセットで使えるトークン発行
  • トークン保存はmemcachedなど揮発性のストレージで良い。使っている限り期限が延長される。最長期限があってもよい(あったほうがよい)
  • ログアウトとセットで破棄されるようになっていると良い
  • iframeはポップアップwindowからメッセージを受け取る。ランダムなid + トークンを使ってAPIにアクセスする。
  • iframeは親windowからメッセージを受け取る。あとはpostMessageでproxyしてXHRのリクエスト、レスポンスをやり取りする。
  • iframeは親windowからのメッセージであることをevent.originを使って検証する
@tokuhirom
tokuhirom / pbvsp.md
Last active December 15, 2015 15:38
Perl5 Boolean Value Serializer Protocol(PBVSP)

Perl5 Boolean Value Serializer Protocol(PBVSP)

Status

Draft. Plase post a comment on gist.

Why?

Most programming languages have a native Boolean data type. Perl does not.

@studio3104
studio3104 / ProvisioningFrameworksCasualTalks01.md
Last active December 16, 2015 10:08
Provisioning Frameworks Casual Talks vol.1

Provisioning Frameworks Casual Talks vol.1

ChefとかPuppetとかの勉強会です
次回があるかはわかりませんが、今回はChef成分多めになっております

インターネット情報

Twitterハッシュタグ #pfcasual
IRCチャンネル #chef-casual@freenode

$ perl installed2cpanfile > cpanfile
$ cpanm --installdeps .
@motemen
motemen / Ojisan-Patterns.md
Last active March 14, 2021 07:37
おじさんパターン集
  • その面白そうな話、私も参加していいよね?なぜなら私は無条件に受け入れられているからおじさん(闖入おじさん) #おじさんパターン
  • 後出し難癖おじさん #おじさんパターン
  • 困難は成長のチャンス!だから君たちに成長の機会をあげようおじさん (成長おじさん) #おじさんパターン
  • あらゆる事案に一般論コメントおじさん #おじさんパターン
  • 俺ってあらゆることに精通してるじゃん?だから力になるよおじさん (精通おじさん) #おじさんパターン
<?
require("redis.php");
require("json.php");
$term = $_GET['term'];
$r = new Redis("127.0.0.1","6379");
$r->connect();
$items = $r->zrangebylex("kernel","[$term","[$term\xff",Array("LIMIT","0","10"));