Skip to content

Instantly share code, notes, and snippets.

@kechol
kechol / bower.rb
Created February 9, 2014 13:12
read repos
#!/usr/bin/env ruby
require "json"
require "uri"
require "net/http"
require "google_drive"
require "./config.rb"
## constants
@kechol
kechol / jquery.appref.js
Created February 13, 2014 02:25
アプリのURLSchemeを開くjQueryプラグイン
/*
* usage:
* <a href="https://itunes.apple.com/app/idxxx?mt=8" data-appref="appscheme://">open app</a>
* <script>$('a').appref();</script>
*/
'use strict';
(function($) {
$.fn.appref = function(options) {
var settings = {
ref: 'appref'
@kechol
kechol / github_repos.rb
Last active August 29, 2015 13:56
Githubのリポジトリを検索し、GoogleDocsにつっこむ
#!/usr/bin/env ruby
require "json"
require "uri"
require "net/http"
require "google_drive"
require "pp"
## help
if ARGV.size < 2
@kechol
kechol / categorize.py
Created March 2, 2014 17:31
categorize textfiles using k-means++ algorithm
#!/usr/bin/env python
#encoding: utf-8
import os
import sys
import re
import csv
import numpy as np
from sklearn.feature_extraction.text import TfidfVectorizer
@kechol
kechol / Podfile
Last active August 29, 2015 14:03
# Uncomment this line to define a global platform for your project
platform :ios, "7.0"
pod 'socket.IO-objc', :podspec => 'https://gist.githubusercontent.com/Kechol/e1794eb2376f82a3825a/raw/07fedcfdcd1420e5d7d026537f309265ce135f42/socket.IO-objc.podspec'
@kechol
kechol / replacePath_test.js
Created July 6, 2014 11:29
just a test for replacePath()
var assert = require("assert");
var fullBucketPath = '/full/bucket/path';
var replacePath = function(){
var path = '';
for(var i in Array.prototype.slice.call(arguments)) {
var val = arguments[i];
if(typeof val==='string'){
if(val.slice(0,1)==='/' && path.slice(-1)==='/'){
var sheet = SpreadsheetApp.getActiveSheet();
function fetch(url) {
var response = UrlFetchApp.fetch(url);
var contentText = response.getContentText();
return contentText;
}
function title(url) {
if(typeof url === 'string' && url.length > 0) {
@kechol
kechol / dpd-seed.js
Last active August 29, 2015 14:04
seed script for deployd
var Server = require('deployd/lib/server')
, options = { port: 7274, db: { host: 'localhost', port: 6042, name: '-deployd' } }
, uuid = require('deployd/lib/util/uuid')
, crypto = require('crypto')
, deployd = new Server(options);
function saveAll(name) {
var store = deployd.createStore(name)
, data = require('./seed/' + name);
@kechol
kechol / vspace.less
Created July 20, 2014 08:07
css helper class to make vertical spaces. it works fine with bootstrap.
.vspace(50);
.vspace(@n, @i: 5) when (@i =< @n) {
.vspace-@{i} {
margin-top: @i * 1px;
margin-bottom: @i * 1px;
}
.vspace-tp-@{i} {
margin-top: @i * 1px;
}
@kechol
kechol / b2g_playbook.yml
Created July 21, 2014 06:50
ansible playbook for b2g on Ubuntu 12.04 LTS
---
- hosts: b2g
remote_user: ubuntu
sudo: yes
vars:
- ccache_size: 3GB
- git_user: b2g
- git_email: b2g@example.com
- b2g_repo: git://github.com/mozilla-b2g/B2G.git