Skip to content

Instantly share code, notes, and snippets.

@amazedkoumei
amazedkoumei / 0_reuse_code.js
Created August 29, 2017 05:02
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@amazedkoumei
amazedkoumei / Gemfile
Created December 4, 2013 03:04
pushtest using parse.com
source 'https://rubygems.org'
gem 'rake'
gem 'motion-cocoapods'
gem "bubble-wrap", :require => "bubble-wrap/all"
query = BW::HTTP.get("http://example.com")
@connection = query.connection
unless @connection.nil?
# これ!
@connection.cancel()
end
@amazedkoumei
amazedkoumei / import.rb
Last active December 19, 2015 22:29 — forked from ngauthier/import.rb
require 'rubygems'
require 'nokogiri'
require 'fileutils'
require 'date'
# usage: ruby import.rb my-blog.xml
# my-blog.xml is a file from Settings -> Basic -> Export in blogger.
data = File.read ARGV[0]
doc = Nokogiri::XML(data)
@amazedkoumei
amazedkoumei / Gemfile
Created April 24, 2013 11:54
rubymotion error when using motion-cocoapods
source "https://rubygems.org"
gem "bubble-wrap", :require => "bubble-wrap/all"
gem "motion-testflight"
#gem "cocoapods", "0.16.4"
#gem "cocoapods", "0.17.1"
gem "cocoapods"
#gem "motion-cocoapods"
@amazedkoumei
amazedkoumei / inform_view_old.rb
Created December 24, 2012 07:11
ブログ貼付用
# -*- coding: utf-8 -*-
class InformView < UIView
attr_accessor :message
def init()
if super
width = 280
height = 100
x = (App.window.frame.size.width - width) / 2
@amazedkoumei
amazedkoumei / readability.rb
Created December 22, 2012 21:03
ブログ貼付用
# method define
["Favorite", "Archive"].each do |name|
define_method("toggle#{name}") do |bookmark, &block|
key = name.downcase
value = bookmark[key] # boolean
# make parameter
if value
v = "0"
else
# TODO: meta
def toggleFavorite(bookmark, &block)
favorite = bookmark[:favorite]
if favorite
f = "0"
else
f = "1"
end
# -*- coding: utf-8 -*-
class InformView < UIView
WIDTH = 280
HEIGHT = 100
# singleton
def self.instance()
# Dispatch.once を使うとinitメソッドのsuperで以下のwaningがでました。どぼちて?
# > unknown: warning: passing a block to an Objective-C method - will be ignored
@amazedkoumei
amazedkoumei / usage.new.rb
Created December 22, 2012 20:55
ブログ貼付用
# show view
InformView.show("loading..", target:navigationController.view, animated:true)
# hide view
InformView.hide(true)