Skip to content

Instantly share code, notes, and snippets.

View SET001's full-sized avatar
🇺🇦

Kostiantyn Kostiuk SET001

🇺🇦
View GitHub Profile
@SET001
SET001 / gist:1169674
Created August 25, 2011 00:41
login shit
User = Backbone.Model.extend({
login_attempts: 3,
login: function(){
var that = this;
var res = null;
$.ajaxSetup({async:false});
$.post(SITE_PATH + 'user/login', $('form#loginform').serialize(), function(data){
try{
res = $.parseJSON(data);
this.views['groupTree'].bind('show_features', function(){
that.navigate('show_features');
});
@SET001
SET001 / editor.js
Created December 22, 2011 16:35
editor
Editor = Backbone.Router.extend({
immo: {},
lm: {},
nav: [],
pages: [],
routes: {
'editor/basic': 'basic',
'editor/basic/:id': 'basic',
'editor/details': 'details',
'editor/details/:id': 'details',
<?php
class Resource{
private $_files = array();
public $type; // either css or js
public $composed_file; // name of composed file
private static $_instances = array();
public function get(){
return $this->_files;
}
$.fn.slider = function(config){
var settings = {
next: $('.btn_next'),
prev: $('.btn_next'),
c_visible_items: null,
item_width: null,
};
if (config) $.extend(settings,config);
var is_clickable = true;
ajax_wrapper = {
override: {
success: function(data){
if (data.wrapped){
if (data.errors.length){
$.each(data.errors, function(key, error){
alert(error);
});
return false;
}
Editor = Backbone.Router.extend({
immo: {},
lm: {},
nav: [],
pages: [],
routes: {
'editor/basic': 'basic_page',
'editor/basic/:id': 'basic_page',
'editor/details': 'details_page',
'editor/details/:id': 'details_page',
<?php
Resource::instance('js')->add(array(
'frontend',
'chicken',
'slider',
'autocomplete',
));
Resource::instance('css')->add(array(
'chicken',
<?php
class Controller_Article extends Layout{
public $secure_actions = array(
'delete' => array('moderator'),
'save' => array('moderator'));
public function action_save(){
$id = $this->request->param('id');
$article = ORM::factory('article', $id);
if (!$article->loaded()){
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable,
# :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :recoverable, :rememberable, :trackable
# :registerable, :validatable
# Setup accessible (or protected) attributes for your model
attr_accessible :first_name, :last_name, :country, :city, :address, :phone, :email, :password, :password_confirmation, :remember_me
# attr_accessible :title, :body