Skip to content

Instantly share code, notes, and snippets.

@yoshik
yoshik / dsstore消す
Created December 15, 2017 01:55
自分用コマンド
find . -name '.DS_Store' -type f -ls -delete
import UIKit
func + (l: CGFloat, r: Int) -> CGFloat {
return l + CGFloat(r)
}
func + (l: Int, r: CGFloat) -> CGFloat {
return CGFloat(l) + r
}
@yoshik
yoshik / UIColor.swift
Created March 13, 2015 05:43
UIColorWithHex
extension UIColor {
class func colorWithHex(hexString: String?) -> UIColor? {
return colorWithHex(hexString, alpha: 1.0)
}
class func colorWithHex(hexString: String?, alpha: CGFloat) -> UIColor? {
if let hexString = hexString {
var error : NSError? = nil
let regexp = NSRegularExpression(pattern: "\\A#[0-9a-f]{6}\\z",
package controllers
import play.api.Play.current
import play.api.libs.oauth.{RequestToken, ServiceInfo, ConsumerKey, OAuth}
import play.api.mvc.{RequestHeader, Action, Controller}
import play.api.Play
object Twitter extends Controller {
val cfg = Play.application.configuration
@yoshik
yoshik / toggle.html
Last active December 21, 2015 17:19
アニメーションつきトグルスイッチ
<input type="checkbox" id="hoge" class="togglebox">
<label for="hoge"><span></span></label>
@yoshik
yoshik / screenSize.html
Last active December 20, 2015 05:28
ScreenSizeに合わせるHTML(教えてもらった。)
<!DOCTYPE html>
<html>
<head>
<style>
body, html, .page {
margin: 0;
height: 100%;
}
.column {
height: 100%;
@yoshik
yoshik / playController1.scala
Last active December 19, 2015 14:19
riak-scala-clientをplayから使ってみた。 tryの中をもっと綺麗に書きたい。
def index2 = Action {
val client = RiakClient("http://hoge.com:1234/")
val bucket = client.bucket("testriak")
val fetch = bucket.fetch("name")
try {
Await.result(fetch,1000 millis)
} catch {
case e: TimeoutException => "timeout " + e
@yoshik
yoshik / get.m
Last active December 18, 2015 21:19
LTSVもどき key1>value1/key2>value2/key3>value3
NSURL* url = [NSURL URLWithString:@"http://localhost:9000/get"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[NSURLConnection
sendAsynchronousRequest:request
queue:[NSOperationQueue mainQueue]
completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
if (error) {
NSLog(@"error: %@", [error localizedDescription]);
return;
}
@yoshik
yoshik / woodbtn.css
Last active December 18, 2015 03:18
wood button
.wrap_button{
margin:10px;
padding:5px;
padding-bottom: 7px;
border-radius: 5px;
box-shadow: inset 0px 3px 5px rgba(0,0,0,0.2);
}
.wrap_button .btn{
height:50px;
@yoshik
yoshik / typography.css
Last active December 16, 2015 08:29
タイポグラフィJS
.font_small {
font-size: 100% ;
}
.font_normal {
font-size: 105% ;
}