Skip to content

Instantly share code, notes, and snippets.

Avatar

Iori ONDA iorionda

  • Freelance
  • Tokyo/Japan
View GitHub Profile
View tif2016.rb
require 'open-uri'
require 'json'
response = open('http://www.idolfes.com/2016/json/timetable/time.json')
data = JSON.parse(response.read)
artists = {}
data.each do |day, stages|
stages.each do |stage, items|
items.each do |item|
View server.py
import logging
from logging.handlers import RotatingFileHandler
from flask import Flask
app = Flask(__name__)
@app.route('/')
def foo():
app.logger.warning('A warning occurred (%d apples)', 42)
View .tigrc
set main-view = id:width=12 date author commit-title:graph=yes,refs=yes
set vertical-split = yes
set split-view-height = 80%
# 差分の前後の表示行数(diff-context)を指定
set diff-context = 6
set blame-view = date:local author:full id line-number:true,interval=1 text
set main-view = line-number:true,interval=10 date:local author:full id commit-title:true,graph=true,refs=true
set refs-view = date:local author:full id ref:true commit-title:true
set status-view = file-name status:long
View jsforce_connect.js
import jsforce from 'jsforce';
var conn = new jsforce.Connection({'loginUrl': 'salesForceURL'});
conn.login('username', 'password+securityToken', function(error, userInfo) {
if (error) {
return console.log(error);
}
conn.sobject('Account').find({}).execute(function(error, records) {
if (error) {
return console.log(error);
View is.js
function is(type, obj) {
var clas = Object.prototype.toString.call(obj).slice(8, -1);
return obj !== undefined && obj !== null && clas === type;
}
@iorionda
iorionda / feedparser.js
Last active Feb 2, 2016
FeedParserの使い方
View feedparser.js
#!/usr/bin/env node
var FeedParser = require('feedparser');
var request = require('request');
var feed = 'https://news.google.com/news?output=rss&q=';
var query = encodeURI('山岳遭難');
var req = request(feed + query);
var feedparser = new FeedParser({});
@iorionda
iorionda / add_news.js
Created Feb 1, 2016
mongoose の ref と populate の sample
View add_news.js
#!/usr/bin/env node
var mongoose = require('bluebird').promisifyAll(require('mongoose'));
var uriUtil = require('mongodb-uri');
var mongodbUri = process.env.MONGOLAB_URI || 'mongodb://localhost/emt-dev';
var mongooseUri = uriUtil.formatMongoose(mongodbUri);
import Company from '../server/api/company/company.model'
import News from '../server/api/news/news.model';
import _ from 'lodash';
@iorionda
iorionda / circle.yml
Created Dec 28, 2015
angular-fullstack
View circle.yml
machine:
node:
version: v5.1.0
dependencies:
pre:
- npm install -g bower
- npm install
- bower install
- node_modules/protractor/bin/webdriver-manager update
@iorionda
iorionda / localhost.yml
Created Dec 16, 2015
HOMEBREW_CASK_OPTS="--appdir=/Applications" ansible-playbook -i hosts -vv localhost.yml
View localhost.yml
- hosts: localhost
connection: local
gather_facts: no
sudo: no
vars:
homebrew_taps:
- homebrew/binary
- homebrew/dupes
- caskroom/cask
- railwaycat/emacsmacport
View fizzbuzz.exs
fizzbuzz = fn
{true, true} -> 'FizzBuzz'
{true, false} -> 'Fizz'
{false, true} -> 'Buzz'
{false, false} -> nil
end
1..100 |> Enum.each fn(n) ->
case fizzbuzz.({rem(n, 3) == 0, rem(n, 5) == 0}) do
nil -> n