Skip to content

Instantly share code, notes, and snippets.

View patorash's full-sized avatar
👓
I'm sleepy

patorash patorash

👓
I'm sleepy
View GitHub Profile
@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?
@carlesandres
carlesandres / Gruntfile.js
Last active December 15, 2015 10:59
Testing Gruntfile configurations for using PHP with Yeoman
'use strict';
//var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet;
//var mountFolder = function (connect, dir) {
// return connect.static(require('path').resolve(dir));
//};
module.exports = function (grunt) {
// load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
@daichan4649
daichan4649 / MainActivity.java
Created April 17, 2012 12:35
DialogFragment sample
package test.fragment;
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentTransaction;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
public class MainActivity extends Activity {
@chetan
chetan / yardoc_cheatsheet.md
Last active April 13, 2025 14:08
YARD cheatsheet
@jwo
jwo / registrations_controller.rb
Created September 30, 2011 23:11
API JSON authentication with Devise
class Api::RegistrationsController < Api::BaseController
respond_to :json
def create
user = User.new(params[:user])
if user.save
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201
return
else
@chsh
chsh / config_loader.rb
Created September 11, 2011 14:22
Load Rails related configuration from yaml file with erb evaluation.
require 'erb'
class ConfigLoader
def self.from(yaml)
yaml = File.read(yaml) if File.exist?(yaml)
YAML.load(ERB.new(yaml).result)[Rails.env]
end
end
@eitoball
eitoball / Authlogic.v.2.1.3.README.ja.rdoc
Created November 20, 2009 17:59
この文書はAuthlogic バージョン2.1.3時点のREADME.rdocを日本語に訳した文書です。This is Japanese-translation of README.rdoc of Authlogic as of version 2.1.3.

Authlogic

Authlogicは、簡潔で柔軟なRubyで記述された認証ソリューションです。

コードで例示して説明した方がいいでしょう…

Authlogicでは新しい型のモデルを提供しています。他のモデルのようにいくつでもどんな名前で必要なだけ作成することができます。この例では、クラス名から分かるようにUserモデルを使って認証を行おうとしています。

class UserSession < Authlogic::Session::Base
  # ここでは以下のように設定項目を記述します: