Skip to content

Instantly share code, notes, and snippets.

@dhh
dhh / Gemfile
Created June 24, 2020 22:23
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
@NAKNAO-nnct
NAKNAO-nnct / bot.rb
Last active August 26, 2021 17:49
Discordのボイスチャンネルに誰かが入ったら通知するbot ref: https://qiita.com/trompot/items/5251704272cce302af33
TOKEN = '自分で取得してね'
CLIENT_ID = ID(数字)
# 通知用のチャンネルID
inform_channel = チャンネルID または '#チャンネルname'
# bot
bot = Discordrb::Commands::CommandBot.new token: TOKEN, client_id: CLIENT_ID, prefix:'/'
# 誰かがvoice channelに出入りしたら発火
@udzura
udzura / LICENSE
Last active May 8, 2021 14:23
やわらかRuby
やわらかRubyはCC BY 4.0 で提供します。
詳細: https://creativecommons.org/licenses/by/4.0/deed.ja
This work is licensed under a Creative Commons Attribution 4.0 International License.
See also: https://creativecommons.org/licenses/by/4.0/deed
@rummelonp
rummelonp / Gemfile
Last active December 17, 2015 16:19
マルコフ連鎖でツイートするやつ
# -*- coding: utf-8 -*-
source 'https://rubygems.org'
gem 'twitter'
gem 'natto'
@KensakuKOMATSU
KensakuKOMATSU / chat.html
Created April 13, 2013 09:03
Peer.jsのチャットサンプルコード(UTF-8対応版w)
<!doctype html>
<html>
<head>
<script type="text/javascript" src="./lib/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="./lib/peer.js"></script>
</head>
<body>
<form id="connect">
<strong>connect to broker</strong><br>
@vexus2
vexus2 / nico_video_fetcher.rb
Created October 8, 2012 14:04
[Ruby]ニコニコ動画APIを叩くとき用。事前にログインさせCookie値を取得する。
# ログインしてクッキー抽出
def login(mail, pass)
host = 'secure.nicovideo.jp'
path = '/secure/login?site=niconico'
body = "mail=#{mail}&password=#{pass}"
https = Net::HTTP.new(host, 443)
https.use_ssl = true
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
response = https.start { |https|
@nono
nono / blowfish.rb
Created June 26, 2012 10:57
How to encrypt and decrypt Blowfish in Ruby 1.9 with https://github.com/drench/blowfish.js
#!/usr/bin/env ruby
require "openssl"
class BF < Struct.new(:key, :pad_with_spaces)
def encrypt(str)
cipher = OpenSSL::Cipher.new('bf-ecb').encrypt
if pad_with_spaces
str += " " until str.bytesize % 8 == 0
cipher.padding = 0
@theconektd
theconektd / github.css
Created April 30, 2012 02:11
Github Markdown CSS - for Markdown Editor Preview
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px; }
body > *:first-child {
@tetu1225
tetu1225 / app.rb
Created July 18, 2011 06:00
Sinatraで画像ファイルをアップロードして表示する
require 'sinatra'
require 'haml'
# 静的コンテンツ参照のためのパス設定
set :public, File.dirname(__FILE__) + '/public'
# アップロード
get '/' do
haml :index
@mikeymckay
mikeymckay / friendly sqlite nosql sinatra
Created August 4, 2010 06:35
friendly sqlite nosql sinatra
#!/usr/bin/env ruby
require 'rubygems'
require 'sinatra'
require 'friendly'
Friendly.configure({
:adapter => "sqlite",
:database => "database.sqlite3"
})