Skip to content

Instantly share code, notes, and snippets.

Avatar
😇
I don't know how my life work with.

Go Furuya gouf

😇
I don't know how my life work with.
View GitHub Profile
@gouf
gouf / qr.rb
Created Aug 26, 2012
QR Code generate test.(using Barby)
View qr.rb
require 'barby'
require 'barby/barcode'
require 'barby/barcode/qr_code'
require 'barby/outputter/png_outputter'
str = 'Hello QrCode!! Using Gem for Barby, Barby-pngOutputter and Chunky-PNG.'
b = Barby::QrCode.new(str, level: :q, size: 10)
File.open('qr.png', 'w') do |f|
f.write b.to_png
@gouf
gouf / keep_img_ratio.css
Created Sep 10, 2012
Keeping aspect ratio
View keep_img_ratio.css
img {
max-width: 100%;
height: auto;
}
@gouf
gouf / jsdoit.css
Created Dec 21, 2012
2012-12-22 2nd
View jsdoit.css
body { background-color: #DDDDDD; font: 30px sans-serif; }
View pop_mailChecker.rb
require 'net/pop'
SERVER = 'pop.example.com'
ACCOUNT = 'example@example.com'
PADDWORD = 'password'
PORT = 995
# use APOP authentication if $isapop == true
pop = Net::POP3.APOP($isapop).new(SERVER, PORT)
View openMailKicker.rb
require 'gmail'
APPLICATION = '/Applications/Google\ Chrome.app'
ACCOUNT = 'your_gmail_account@gmail.com'
PASSWORD = 'password'
MAIL_FROM = 'your_mobile_phone@exmple.com'
gmail = Gmail.connect ACCOUNT, PASSWORD
View coloring.html
<!DOCTYPE HTML>
<html lang="ja-JP">
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
div#a {
color: #ABABAB;
}
div#b {
@gouf
gouf / tw_timeline.rb
Created Jan 24, 2013
最新のTweet 150を適当な形に整形してファイルに保存。 tw.rb には認証情報を書き込んであります。別途自身でご用意ください。
View tw_timeline.rb
require '~/tw.rb'
puts 'Opening file stream...'
file = ''
path = '/path/to/text/tweet_dump.txt'
if File.exists? path
file = File.open(path, 'a+')
else
file = File.open(path, 'w')
end
@gouf
gouf / toggleMenu.html
Created Mar 4, 2013
Fade out → Fade in より、Display : none → Fade in のほうがスムーズに映るみたい
View toggleMenu.html
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<style>
div.box {
margin: 3px;
border: thin solid silver;
@gouf
gouf / textCrypt.php
Created Mar 14, 2013
PHP でテキスト暗号化・復号
View textCrypt.php
<?php
// 暗号化準備
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$plainText = 'This is plain text.';
// Crypt:
$cd = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $plainText, MCRYPT_MODE_ECB, $iv);
@gouf
gouf / server.rb
Last active Dec 20, 2015
Simple Webserver, Webrick
View server.rb
require 'webrick'
include WEBrick
root = File.expand_path(File.dirname($0))
server = WEBrick::HTTPServer.new :Port => 3000, :DocumentRoot => root
trap 'INT' do server.shutdown end
server.start