Skip to content

Instantly share code, notes, and snippets.

# config/routes.rb
Demo::Application.routes.draw do
devise_for :users
root :to => "map#index"
end
# rake routes
(in /home/kir/rails/demo)
new_user_session GET /users/sign_in(.:format) {:action=>"new", :controller=>"devise/sessions"}
user_session POST /users/sign_in(.:format) {:action=>"create", :controller=>"devise/sessions"}
@kirs
kirs / gist:984320
Created May 21, 2011 07:01
broken rakefile
require File.expand_path('../config/application', __FILE__)
require 'rake'
Dpp::Application.load_tasks
module ::Dpp
class Application
include Rake::DSL
end
end
@kirs
kirs / PayController.php
Created July 28, 2011 06:47
PayController.php
<?php
class PayController extends Controller
{
public function actionIndex()
{
$this->render('about',array());
}
public function actionForm()
@kirs
kirs / BMW.html
Created August 29, 2011 15:21
Encrypted html
<html>
<head>
<meta http-equiv="Content-type" Content="text/html; charset=windows-1251">
</head>
<script language="JScript.Encode" src="../../js/global.js"></script>
<script language = JScript.Encode>#@~^WBoAAA==@#@&d-mD,HrG2djP{P,Tp@#@&77lD,(1wrP{~`8p@#@&@#@&H69ASj$t6fASj ^+xLO4T~',`bNlyvF,&l~slBt&~&c vS0)BAfvE~w=vf 8BBXr)q1O*S:bl,BXdl8,,1Ss/l%BO0)vêàáðèîëåòE~9)ByB,Nitr92d?,\}f2djR^+xTO4T,', rNl++G1cZS:=B\f,&R+vB3lBAf+BSa)E& 8BBzk=F1,l~hr=,~Hd)8,,OSh/=cBYV)vêóïåvBNlByvP)i\6G2Sj,tr92djcVn oDtT,',`k9)+vF,{B:)E\&,&RyvS3=BA&BS2=Bf 8v~HklqO,*Shb)1~Hd=F1OGB:/=F8SY0)vñåäàíBBNlvWBP)IH}f2dj,H}fASjRsn oOtY~', r[= v1XZ S:=vt&~2RyB~0)E3c+BSw=Bf*2B~Hr)y!!ZShk=FZ~z/l+Z!~sd)O~OV=BêóïåBS[=B+B,NpH6G2d?$trG3SURs+ oO4YP',`k9) FT1!y~s)vHf~2R+BBV)E2*E~wlv2cfBBzb)+Z!8~:b)WSXk)+!ZvShk),BO3=BêàáðèîëåòBB[lByB,8IH69ASj$t6fASj ^+xLO4T~',`bNlyGW&v+~slBt&~ZUSvS0)BA*vE~w=vfvZBBXr)+TZ&S:bl*BXdly!!fSs/lFySD3lEêóïåBBN)E E~8pH6fASj,trfAJ?cV+ LOtYP{P`k[ly%{vlT~s)v\2Pc TE~V)E3O!vBw=Bcy!ESXb)+!ZGShb)FZSXk)x!ss~s/=x;VsSD3lBñåäàíESN=B*v,8i
@kirs
kirs / gist:1180272
Created August 30, 2011 05:51
NginX config for Rails 3.1 & Unicorn
upstream example_backend {
server unix:/var/www/example.com/shared/unicorn.sock;
}
server {
listen 80;
server_name example.com www.example.com;
access_log off;
error_log off;
client_max_body_size 20M;
@kirs
kirs / gist:1184502
Created August 31, 2011 19:43
Czech symbols mapping for Sphinx
index test
{
# your config
charset_table = 0..9, A..Z-&gt;a..z, _, a..z, a..z, \
U+e1-&gt;a, U+c1-&gt;a, U+10d-&gt;c, U+10c-&gt;c, U+10f-&gt;d, U+10e-&gt;d, \
U+0e9-&gt;e, U+0c9-&gt;e, U+11b-&gt;e, U+11a-&gt;e, U+0ed-&gt;i, U+0cd-&gt;i, \
U+148-&gt;n, U+147-&gt;n, U+f3-&gt;o, U+d3-&gt;o, U+159-&gt;r, U+158-&gt;r, \
U+161-&gt;s, U+160-&gt;s, U+165-&gt;t, U+164-&gt;t, U+fa-&gt;u, U+da-&gt;u, \
U+16f-&gt;u, U+16e-&gt;u, U+fd-&gt;y, U+dd-&gt;y, U+17e-&gt;z, U+17d-&gt;z
}
@kirs
kirs / _form.php
Created September 3, 2011 06:34
CActiveForm example
<div class="b-form">
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'book-form',
'enableAjaxValidation'=>false,
)); ?>
<div class="b-form-row">
<?php echo $form->labelEx($model,'title', array('label'=>$model->getAttributeLabel('title').':')); ?>
<?php echo $form->textField($model,'title',array('maxlength'=>255)); ?>
@kirs
kirs / gist:1193428
Created September 4, 2011 20:08
nginx config for capistrano maintenance
# this rewrites all the requests to the maintenance.html
# page if it exists in the doc root. This is for capistrano's
# disable web task
if (-f $document_root/system/maintenance.html) {
rewrite ^(.*)$ /system/maintenance.html last;
break;
}
@kirs
kirs / action.php
Created September 10, 2011 06:47 — forked from anonymous/gist:1208029
public function actionRegistr()
{
$form = new RegistrForm;
if (!Yii::app()->user->isGuest) {
throw new CException('Вы уже зарегистрированны!');
} else {
if (isset($_POST['RegistrForm'])) {
$form->attributes = $_POST['RegistrForm'];
<?php
public function actionCreate()
{
$model=new User;
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['User']))
{