Skip to content

Instantly share code, notes, and snippets.

View zoghal's full-sized avatar
🏠
Working from home

Saleh Souzanchi zoghal

🏠
Working from home
View GitHub Profile
@zoghal
zoghal / rails_resources.md
Created January 20, 2014 20:23 — forked from jookyboi/rails_resources.md
Rails-related Gems and guides to accelerate your web project.

Gems

  • Bundler - Bundler maintains a consistent environment for ruby applications. It tracks an application's code and the rubygems it needs to run, so that an application will always have the exact gems (and versions) that it needs to run.
  • rabl - General ruby templating with json, bson, xml, plist and msgpack support
  • Thin - Very fast and lightweight Ruby web server
  • Unicorn - Unicorn is an HTTP server for Rack applications designed to only serve fast clients on low-latency, high-bandwidth connections and take advantage of features in Unix/Unix-like kernels.
  • SimpleCov - SimpleCov is a code coverage analysis tool for Ruby 1.9.
  • Zeus - Zeus preloads your Rails app so that your normal development tasks such as console, server, generate, and specs/tests take less than one second.
  • [factory_girl](h
@zoghal
zoghal / javascript_resources.md
Created January 20, 2014 20:23 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
$.ajaxSetup({
beforeSend: function(xhr, settings) {
function getCookie(name) {
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {
init: function() {
var view = this;
var resizeHandler = function() {
view.rerender();
};
this.set('resizeHandler', resizeHandler);
$(window).bind('resize', this.get('resizeHandler'));
},
@zoghal
zoghal / file_picker.js
Created November 1, 2012 22:54
Ember.FilePicker
var get = Ember.get, set = Ember.set, getPath = Ember.getPath;
Ember.FilePicker = Ember.Button.extend({
tagName: 'span',
classNames: ['ember-filepicker'],
classNameBindings: ['disabled'],
/**
* @type {String}
*/
@zoghal
zoghal / pagination_support.js
Created October 13, 2012 20:26
Ember.PaginationSupport
var get = Ember.get;
/**
@extends Ember.Mixin
Implements common pagination management properties for controllers.
*/
Ember.PaginationSupport = Ember.Mixin.create({
/**
*/
@zoghal
zoghal / key_responder.js
Created October 13, 2012 20:15
KeyResponder
(function() {
var get = Ember.get, set = Ember.set;
/*
Holds a stack of key responder views. With this we can neatly handle restoring the previous key responder
when some modal UI element is closed. There's a few simple rules that governs the usage of the stack:
- mouse click does .replace (this should also be used for programmatically taking focus when not a modal element)
- opening a modal UI element does .push
- closing a modal element does .pop
@zoghal
zoghal / dev_view.coffee
Created August 26, 2012 01:09 — forked from charlesjolley/dev_view.coffee
Adding event locks to Ember
# example view implements a simple dragging for mouse events.
Wall.DevView = Ember.View.extend
mouseDown: (ev) ->
ev.dispatcher.lock @, 'mouseMove', 'mouseUp'
@_mouseDown = @$().offset()
@_mouseDown.pageX = ev.pageX
@_mouseDown.pageY = ev.pageY
@_mouseDown.dispatcher = ev.dispatcher
console.log 'mouseDown'
@zoghal
zoghal / transition_end_on_app.js
Created July 30, 2012 19:09 — forked from ppcano/transition_end_on_app.js
How to receive transitionEnd events on the view layer, which option is the most suitable?
App = Em.Application.create({
customEvents: {
webkitTransitionEnd: 'transitionEnd'
}
});
Em.View.extend({
transitionEnd: function(event) {
@zoghal
zoghal / carousel_view.js
Created July 27, 2012 15:01 — forked from johanvalcoog/carousel_view.js
Ember Touch ScrollView without iScroll, and using movejs for transfomations.