Skip to content

Instantly share code, notes, and snippets.

@kkosuge
kkosuge / .env
Created July 24, 2017 03:19
Slack のステータス変更スクリプト
SLACK_TOKEN=lgsolashdgoalisdhgaldgahksdg
require 'twitter'
client = Twitter::REST::Client.new do |config|
config.consumer_key = "YOUR_CONSUMER_KEY"
config.consumer_secret = "YOUR_CONSUMER_SECRET"
config.access_token = "YOUR_ACCESS_TOKEN"
config.access_token_secret = "YOUR_ACCESS_SECRET"
end
print "screen_name: "
@thebucknerlife
thebucknerlife / authentication_with_bcrypt_in_rails_4.md
Last active January 17, 2024 23:54
Simple Authentication in Rail 4 Using Bcrypt

#Simple Authentication with Bcrypt

This tutorial is for adding authentication to a vanilla Ruby on Rails app using Bcrypt and has_secure_password.

The steps below are based on Ryan Bates's approach from Railscast #250 Authentication from Scratch (revised).

You can see the final source code here: repo. I began with a stock rails app using rails new gif_vault

##Steps

@taea
taea / rm_pid.md
Last active January 12, 2023 14:22
postgres をちゃんと終了しないと.pidファイルが残っちゃって、Rails が起動しないもんだい

Rails 起動しようとするとこんなエラーでる

PG::ConnectionBad at /
could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
@hitode909
hitode909 / commit-dates-for-word-of-repository.rb
Created January 4, 2014 09:31
リポジトリ内で指定した単語が書かれた時期を調べる
require 'shellwords'
class AnnotateLine
attr_reader :content, :meta
def initialize
@meta = {}
@content = nil
end
def add_line line

redcaretとgithub-markdownの違い

  • 両者のソースは割りと似ている(github-markdownがredcarpetを元にしたのか、あるいは両者のもとになったC実装があるとかかな)

オプションについて

github-markdownは、redcapetの提供するオプションの一部をデフォルトで有効化します。 (ちなみに有効化するオプションを選ぶAPIはない模様。用途を考えるとそれで正しいが)

★がついているのが有効化されるもの。gfmモード(.render_gfmメソッド)の場合のみ、★★も有効化される。

@esehara
esehara / file0.txt
Created July 2, 2013 01:27
コンソールから色々なURLを開くやつ用意するとちょうべんり ref: http://qiita.com/esehara@github/items/5b51776cd03c9cd6d66f
export console_browser='lynx'
export browser='chromium-browser --new-window'
#usage
#
# $ wikipedia デスマーチ
# $ english 関数
# $ what zsh
#
@uiur
uiur / gifboom_api.md
Last active December 15, 2015 06:49
GifBoomのJSON API

GifBoomのJSON API

GifBoomのWeb APIを調べたのでメモ。公開されてるものではないので使用は自己責任で。とりあえず便利そうなやつだけ。

レスポンスはすべてJSON形式で返ってくる。だいたいのAPIは認証なしで使える模様。

あるユーザーの投稿したGIF一覧を取得したい場合、まず/v1/users/searchでusernameからuser_idをとってきて、そのuser_idを使って/v1/feed/user_timelineにリクエストを投げればいい。

GET /v1/users/search

ユーザーを検索する。usernameからuser_idをとってくるのに使える。

require "open-uri"
require "nokogiri"
require "pp"
base_url = "http://dribbble.com"
@file = File.open('dribbble_profile_urls.txt','w')
def get_web_link(url)
doc = Nokogiri::HTML(open(url))
doc.css('.profile-details .url').each do |link|
@lg0
lg0 / markdown.xml
Created April 10, 2012 19:58
Markdown Syntax Highlighting for Sublime text 2
<!-- copy this to YOUR_THEME.tmTheme-->
<dict>
<key>name</key>
<string>diff: deleted</string>
<key>scope</key>
<string>markup.deleted</string>
<key>settings</key>
<dict>
<key>background</key>
<string>#EAE3CA</string>