Skip to content

Instantly share code, notes, and snippets.

// ==UserScript==
// @match http://*/*
// ==/UserScript==
(function() {
var inputs = document.querySelectorAll('input[type=text]');
for(var i = 0; i < inputs.length; i++) {
inputs[i].webkitSpeech = true;
inputs[i].addEventListener('speechchange', changed, false);
inputs[i].addEventListener('webkitspeechchange', changed, false);
}
@y310
y310 / example.rb
Created July 24, 2011 23:37
nil guard
require 'nil_guard'
include NilGuard::Helper
foo = Foo.new
# 'foo' may be nil, 'bar' may be nil, 'text' may ...
value = nilg(foo).bar.text.to_s.to_value_or_nil #=> nil or value
@y310
y310 / gist:1289270
Created October 15, 2011 08:31
show font-size variation
jQuery.unique(
jQuery.makeArray(
jQuery('*').map(function(){
return parseInt(jQuery(this).css('font-size').slice(0, -2));
})
).sort(function(a, b){
return a < b
})
)
@y310
y310 / gist:7499626
Last active December 28, 2015 12:19
{
"title": "My Dashboard",
"services": {
"query": {
"idQueue": [],
"list": {
"0": {
"id": 0,
"color": "#7EB26D",
"query": "title:\"踊ってみた\"",
@y310
y310 / gist:9003262
Last active August 29, 2015 13:56
Obj-C pagination PoC
@implementation TableViewController1
- (void)viewDidLoad
{
BaseRequester *requester = [[BaseRequester alloc] initWithPath:@"/recipes"
params:@{@"fields":@"id,name"}
model:[Recipe class]]
self.paginator = [Paginator instantiateWithReuseidentifier:@"recipes"
requester:requester
perPage:10];
if (self.recipes.count == 0) {
@y310
y310 / Usage.sh
Last active August 29, 2015 13:57
./ios_app_icon.rb project.xcodeproj Release | xargs -n 1 -IICON ./composite.sh ICON ribbon.png
./ios_app_icon.rb project.xcodeproj Release | xargs -n 1 -IICON ./replace.sh ICON beta.png
@y310
y310 / autoflight.png
Last active August 29, 2015 13:58
Utilities for AutoFlight
autoflight.png
@y310
y310 / gist:10244018
Last active August 29, 2015 13:58
potatotips #6

AutoFlight

〜簡単セットアップで自動ビルド〜

課題

Jenkinsによるビルド自動化とTestFlightアップロードはよくWeb上にも情報があるのですが、大概プロジェクトごとにジョブを作る必要があって煩雑でした。

なので、簡単なセットアップで任意のiOSプロジェクトでビルドできる仕組みを作りました!

@y310
y310 / multiplex.rb
Last active June 17, 2018 04:22
lib/graphql/execution/multiplex.rb
# https://github.com/rmosolgo/graphql-ruby/blob/v1.8.1/lib/graphql/execution/multiplex.rb#L77-L98
def run_as_multiplex(multiplex)
queries = multiplex.queries
# Do as much eager evaluation of the query as possible
results = queries.map do |query|
begin_query(query)
end
# Then, work through lazy results in a breadth-first way
GraphQL::Execution::Execute::ExecutionFunctions.lazy_resolve_root_selection(results, { multiplex: multiplex })
# Run "gem install graphql" before executing this file
require 'graphql'
# Dummy model class
class User
def self.find_by(id:)
OpenStruct.new(id: id, name: 'test user')
end
end