Skip to content

Instantly share code, notes, and snippets.

View rscnt's full-sized avatar
👁️‍🗨️

raul rscnt

👁️‍🗨️
View GitHub Profile
@mikeyk
mikeyk / redis_session_backend.py
Created April 8, 2011 18:01
A redis backend for Django Sessions, tested on Django 1.3+
from django.contrib.sessions.backends.base import SessionBase, CreateError
from django.conf import settings
from django.utils.encoding import force_unicode
import redis
class SessionStore(SessionBase):
""" Redis store for sessions"""
def __init__(self, session_key=None):
self.redis = redis.Redis(
@weakish
weakish / README.markdown
Last active December 18, 2023 05:58
#Solarized themes (dark and light) for #roxterm.
@dhh
dhh / gist:1014971
Created June 8, 2011 18:09
Use concerns to keep your models manageable
# autoload concerns
module YourApp
class Application < Rails::Application
config.autoload_paths += %W(
#{config.root}/app/controllers/concerns
#{config.root}/app/models/concerns
)
end
end
@jonashaag
jonashaag / 0-howto-listfield-django-admin.rst
Created September 7, 2011 09:41
Howto use ListFields in Django's admin

Howto use ListFields in Django's admin

Problem

Consider this blog post model:

models.py

@the-architect
the-architect / contact.rb
Created September 15, 2011 16:09
Automatically create scopes for all available state_machine states in Rails 3.1
class Contact < ActiveRecord::Base
state_machine :state, :initial => :imported do
state :imported
state :contacted
state :verified
state :prospect
state :deleted
end
@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
@johankool
johankool / NSURL+PathParameters.h
Created October 1, 2011 17:21
NSURL+PathParameters
//
// NSURL+PathParameters.h
//
// Created by Johan Kool on 27/9/2011.
// Copyright 2011 Koolistov Pte. Ltd. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice, this list of
@chetan
chetan / yardoc_cheatsheet.md
Last active April 13, 2025 14:08
YARD cheatsheet
@nikcub
nikcub / README.md
Created October 4, 2012 13:06
Facebook PHP Source Code from August 2007
@JoshCheek
JoshCheek / setting_a_hidden_field_with_capybara.rb
Created November 1, 2012 14:56
Setting a hidden field with Capybara
require 'sinatra/base'
class ExampleApp < Sinatra::Base
get '/get_form' do
'<html>
<body>
<form action="/post_form" method="post" accept-charset="utf-8">
<input type="hidden" name="hidden_face" value=":(" id="hidden_face">
<p><input type="submit" value="Submit!"></p>
</form>