Skip to content

Instantly share code, notes, and snippets.

View akhedrane's full-sized avatar
🎯
Focusing

Atallah khedrane akhedrane

🎯
Focusing
View GitHub Profile
@zerowidth
zerowidth / paginated_collection.js
Created November 18, 2010 22:04
first whack at pagination with backbone.js
// includes bindings for fetching/fetched
PaginatedCollection = Backbone.Collection.extend({
initialize: function() {
_.bindAll(this, 'parse', 'url', 'pageInfo', 'nextPage', 'previousPage');
this.page = 1;
},
fetch: function(options) {
options || (options = {});
this.trigger("fetching");
* {
-webkit-border-radius: 0 !important;
-moz-border-radius: 0 !important;
border-radius: 0 !important;
-webkit-box-shadow: 0 !important;
-moz-box-shadow: 0 !important;
box-shadow: 0 !important;
-webkit-transition: none !important;
anonymous
anonymous / index.php
Created October 18, 2011 20:38
Expose Slim urlFor to Twig
<?php
// Wrapper function to access urlFor.
function slim_url_for($name, $params = array()) {
return Slim::getInstance()->urlFor($name, $params);
}
// Setup Twig.
TwigView::$twigDirectory = '/path/to/twig/';
// Expose urlFor to Twig.
@mbrio
mbrio / backbone-sync-storageEngines.js
Created December 12, 2011 17:30
Backbone Sync Storage Engines + localStorage
/**
* User: k33g (Original Author)
* Date: 26/08/11
* User: mbrio (Added ability to create and specify multiple storage engines)
* Date: 12/12/11
*/
(function(Backbone) {
Backbone.storageEngines = {
default: Backbone.sync,
@akhedrane
akhedrane / JS Util solution using underscore.js
Created January 25, 2012 11:42 — forked from HenrikJoreteg/JS Util solution using underscore.js
Rather than creating some other util global, just extend underscore.js with any additional methods you want.
// If you don't use underscore.js, use it (http://documentcloud.github.com/underscore/)
// Then, use underscore's mixin method to extend it with all your other utility methods
// like so:
_.mixin({
escapeHtml: function () {
return this.replace(/&/g,'&amp;')
.replace(/>/g,'&gt;')
.replace(/</g,'&lt;')
.replace(/"/g,'&quot;')
.replace(/'/g,'&#39;');
@ziadoz
ziadoz / awesome-php.md
Last active July 13, 2024 05:29
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.
@akhedrane
akhedrane / Convert_FR.sql
Created April 26, 2012 14:29
This MySQL function can convert numbers to french words. usage: SELECT Convert_FR('56.23', 'Dinars','Centimes');
CREATE DEFINER = 'root'@'localhost' FUNCTION `Convert_FR`(chIFfre varchar(20), SM varchar(40),CM varchar(40))
RETURNS varchar(255) CHARSET utf8 COLLATE utf8_unicode_ci
NOT DETERMINISTIC
CONTAINS SQL
SQL SECURITY DEFINER
COMMENT ''
BEGIN
DECLARE ch_int Varchar(20);
DECLARE ch, ch_r Varchar(255);
DECLARE i, fin_I INT;
@cllunsford
cllunsford / meteor-oauth-client.js
Created May 4, 2012 15:05
Oauth using Meteor and Backbone
var AUTH_URL = "https://api.glitch.com/oauth2/authorize?response_type=code&client_id=000yourclientid000&redirect_uri=http://yoursitehere/oauth/&scope=identity";
var Auth_Router = Backbone.Router.extend({
routes: {
"": "root",
"oauth/?code=:code": "auth"
},
root: function () {},
auth: function (code) {
Meteor.call('authenticate', code, function (error, result) {
@thomaspark
thomaspark / subnav.css
Last active June 6, 2023 10:19
Subnav for Bootstrap 2
section {
padding-top: 60px;
}
.subnav {
margin-bottom: 60px;
width: 100%;
height: 36px;
background-color: #eeeeee; /* Old browsers */
background-repeat: repeat-x; /* Repeat the gradient */
@jdennes
jdennes / createsend-oauth.php
Last active December 13, 2015 20:58
A PHP application to demonstrate authenticating with the Campaign Monitor API using OAuth. Uses the createsend-php library as well as the Slim PHP micro framework (but could easily be adapted for use with any PHP framework).
<?php
# 1. Ensure you have Slim installed and in your include path.
# 2. Ensure you have createsend-php installed and in your include path.
# 3. Set CREATESEND_CLIENT_ID, CREATESEND_CLIENT_SECRET,
# and CREATESEND_REDIRECT_URI environment variables for
# your registered OAuth application.
require 'createsend/csrest_general.php';
require 'Slim/Slim.php';
\Slim\Slim::registerAutoloader();