Skip to content

Instantly share code, notes, and snippets.

@cieux1
cieux1 / index.js
Created January 10, 2019 06:04
for nuxtjs blog post
// store/index.js
const createStore = () => {
return new Vuex.Store({
state: {
isNewHighScore: false,
bgSong: {}
},
mutations: {
setIsNewHighScore(state) {
state.isNewHighScore = true;
@cieux1
cieux1 / hello.rb
Created September 17, 2018 02:21
hello-sinippet-test.rb
puts "Hello!"
@cieux1
cieux1 / check_the_shukkin_mail.rb
Created April 15, 2015 09:03
how I click my time card via my pebble
require 'gmail'
require 'chatwork'
require './click_timecard.rb'
ChatWork.api_key = "CHATWORKのAPIキー"
def chat(text)
ChatWork::Message.create( room_id: "xxxxxxx", body: text )
end
@cieux1
cieux1 / send_link_click_events.js
Last active August 29, 2015 14:08
send link click events to universal analytics
@cieux1
cieux1 / open_terminal_and_execute_ruby_file
Created September 13, 2014 00:38
open terminal and execute ruby file
on run {input, parameters}
tell application "Terminal"
activate
do script "cd /path/to/the/ruby/file && ruby do_that.rb && open "http://google.com" && exit"
end tell
return input
end run
function diffDay(y,m,d) {
var diff = Math.floor((new Date(y,m-1,d) - new Date()) / 86400000) + 1;
document.getElementById("count_down_image").innerHTML = '<img src="' + diff + '_days_left.png" />';
}
diffDay(2013,12,31);
@cieux1
cieux1 / get-whois-admins.rb
Created September 25, 2013 09:34
gem whois example
require 'whois'
def get_whois_info(domains)
domains.each do |domain|
r = Whois::query(domain)
t = r.technical_contacts
begin
puts "#{domain}, #{t[0].email}, #{t[0].name}"
rescue => e
puts "#{domain}, #{e}"
@cieux1
cieux1 / search_in_shift_jis_html.rb
Last active December 21, 2015 00:08
Shift_JISファイル内を検索するとき用
#! /usr/bin/local/ruby
# -*- encoding: utf-8 -*-
require 'uri'
def find_matched(arr, reg, reg2)
puts "検索文字列1:" + reg
puts "検索文字列2:" + reg2
arr.each do |file_name|
require 'gmail'
require 'date'
def fetch_attachmets(id, pass, label_name, from_date)
dir_name = "#{Dir.pwd}/#{Date.today}"
Dir.mkdir(dir_name) unless File.exists?(dir_name)
begin
Gmail.connect(id, pass) do |gmail|
puts gmail.logged_in? ? "login OK" : "NOT Logged in!!!!"
puts "Checking mails after #{from_date}..."
@cieux1
cieux1 / find-html-has-too-big-images.rb
Created August 7, 2013 06:07
find htmls which has too big images. # ruby this.rb >> output.csv
require 'uri'
def find_html(img_name, html_arr)
img_basename = File.basename(img_name)
html_arr.each do |file_name|
htmlname = "http://www." + File.dirname(file_name) + "/" + File.basename(file_name)
open(file_name) do |f|
src = f.read
if /(#{img_basename})/ =~ src
puts "#{htmlname}, #{img_name}"