Skip to content

Instantly share code, notes, and snippets.

View gouf's full-sized 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 August 26, 2012 10:45
QR Code generate test.(using Barby)
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 September 10, 2012 08:10
Keeping aspect ratio
img {
max-width: 100%;
height: auto;
}
@gouf
gouf / jsdoit.css
Created December 21, 2012 19:25
2012-12-22 2nd
body { background-color: #DDDDDD; font: 30px sans-serif; }
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)
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
@gouf
gouf / coloring.html
Last active December 11, 2015 07:59
<!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 January 24, 2013 12:27
最新のTweet 150を適当な形に整形してファイルに保存。 tw.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 March 4, 2013 07:14
Fade out → Fade in より、Display : none → Fade in のほうがスムーズに映るみたい
<!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 March 14, 2013 08:17
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 December 20, 2015 02:09
Simple Webserver, Webrick
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