Skip to content

Instantly share code, notes, and snippets.

View cherifGsoul's full-sized avatar
🎯
Focusing

Cherif Bouchelaghem cherifGsoul

🎯
Focusing
View GitHub Profile
@cherifGsoul
cherifGsoul / gist:6108069
Created July 29, 2013 21:35
Setters and getters
public function __get($name)
{
$getter='get'.$name;
if(method_exists($this,$getter))
return $this->$getter();
...
public function __set($name,$value)
{
@cherifGsoul
cherifGsoul / view.php
Created July 29, 2013 21:26
Utilisation d'un composant Yii
<?php
$post = new Post();
$post->title="Titre pour mon article";
echo $post->title; // affiche "Titre pour mon article"
?>
@cherifGsoul
cherifGsoul / view.php
Last active December 20, 2015 09:29
Affichage de propriétés de classe PHP simple
<?php
$post = new Post();
$post->setTitle("Titre pour mon article");
echo $post->getTitle(); // affiche "Titre pour mon article"
?>
@cherifGsoul
cherifGsoul / Post.php
Created July 29, 2013 21:07
Simple php classe
<?php
/**
*
*/
class Post
{
private $id;
private $title;
private $content;
private $categorie;
@cherifGsoul
cherifGsoul / Post.php
Last active December 20, 2015 09:29
Yii PHP framework Component
<?php
/**
*
*/
class Post extends CComponent
{
private $id;
private $title;
private $content;
private $categorie;

Backbone helps you structure your application. This is great, but it doesn't solve the whole problem. CanJS helps you structure your application and lets you actually focus on the part that matters, which is your data.

CanJS essentially gives you all the simplicity of Backbone (model and control layer and no weird asynchronous event loop like Ember and Angular), along with more advanced features that make writing apps much faster and the code more maintainable.

Backbone is popular because its very simple and easy to understand. They are aiming for that level JUST above basic jQuery development, people who just learned jQuery and are looking for a way to organize their code a bit more. It provides this. So does CanJS. But for large complex applications, Backbone lacks a lot of the things we need to make a great app.

Live Binding

Backbone has no concept of binding data object and their changes to your templates.

Susy Tutorial

For this tutorial I'm assuming you are already comfortable with CSS, Sass (I'll use the SCSS syntax) and Compass. Please get set up with each one of those before attempting to use Susy. Sass and Compass both have their own setup instructions and tutorials that you can use.

There is also reference documentation in the works.

What Susy Does

CSS Systems

@import "colors";
@import "buttons.scss";
@import "compass/css3";
@mixin tabs {
float: left;
width: 100%;
background: transparent;
margin: 0!important;
height: 43px;

CanJS Notification System

This widget creates a growl-like notification on a website using CanJS framework.

JavaScript

steal('can/construct',
	  'can/construct/super',
	  'can/construct/proxy',

'can/control',

Purpose

Client-side models are becoming more common. Most work with JSON-REST interfaces by default. However, there is no standards around manipulating the set of data returned by a rest service. This attempts to come to some standard.

Goal

  • Make it easy to understand and have close parallels with common SQL paradigms and relational algebra.
  • Make work with standard server-side Query string libraries.

Existing Problems