Skip to content

Instantly share code, notes, and snippets.

View dayudodo's full-sized avatar
💭
coding...

Adam Lu dayudodo

💭
coding...
View GitHub Profile
# https://pixabay.com/api/?username=dayudodo&key=13eb0e81095a3556e172&q=yellow+flower&image_type=photo
# 读取返回数据
require 'json'
require 'ostruct'
serialized = File.read("pixababy_return.json")
data = JSON.parse(serialized)
# p data["totalHits"]
@dayudodo
dayudodo / turnCSharpTimeToRubyTime.rb
Created May 6, 2013 18:48
Turn C# time to ruby Time
def turnCSharpTimeToRubyTime(sourceTime)
reg=/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})\.(\d{7})/
temp,year,month,day,hour,minute,second,nsec=reg.match(sourceTime).to_a
return [year,month,day,hour,minute,second,nsec].map{|x| x.to_i}
end
# C# time String
timeStr="2011-08-11T11:17:55.7707133+08:00"
arr=turnCSharpTimeToRubyTime(timeStr)
@dayudodo
dayudodo / lrcParser.js
Last active April 13, 2017 09:09
LRC解析器
//node程序
//传递读取到的lrc文件内容content
function lrcParser(content){
//将数据分解为数组
var data = content.replace(/\r/g,'')
var _arrayOfLrc=data.split("\n");
var _LRC={
lyrics:[]
};