Skip to content

Instantly share code, notes, and snippets.

View ashrafuzzaman's full-sized avatar

A.K.M. Ashrafuzzaman ashrafuzzaman

View GitHub Profile
./config/../config/../vendor/rails/railties/lib/rails/gem_dependency.rb:99:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement
[Deprecation Warning] Naming tasks with before_ and after_ is deprecated, please see the new before() and after() methods. (Offending task name was after_update_code)
[Deprecation Warning] Naming tasks with before_ and after_ is deprecated, please see the new before() and after() methods. (Offending task name was before_symlink)
[Deprecation Warning] Naming tasks with before_ and after_ is deprecated, please see the new before() and after() methods. (Offending task name was after_deploy)
* executing `deploy'
* executing `deploy:update'
** transaction: start
* executing `deploy:update_code'
updating the cached checkout on all servers
executing locally: "git ls-remote git@github.com:bodilija/simplesignup.git master"
require File.dirname(__FILE__) + '/../config/environment'
set :application, "events"
set :rails_env, (ENV['env'] || "production")
set :deploy_to, (rails_env == "production" ? "/var/www/apps/#{application}" : "/var/www/apps/#{application}_#{rails_env}")
default_domain = case rails_env
when "production"
"simplesignup.se"
when "staging"
"simplesignup.se"
class BrowsingTest < ActionDispatch::PerformanceTest
def test_homepage
get '/'
end
end
@ashrafuzzaman
ashrafuzzaman / Jquery HTML Widget
Created July 29, 2012 07:32
Sample JQuery based HTML widget, which uses 3rd party jquery plugins . For styling it is easy to maintain with SCSS, as we need the nested style so that the widget style don't hamper the site style.
/*
* Reference: http://alexmarandon.com/articles/web_widget_jquery/
* Slider used: http://bxslider.com/examples
* Shadow effects: http://www.paulund.co.uk/creating-different-css3-box-shadows-effects
* Blogspot JSON feed: http://beautifulbeta.wikidot.com/json-feeds
*
* Usage:
* Add the following code in the html
*
* ------------------------------------------------------------------------------------------------
# File: config/initializers/date.rb
# Parse date using Rails I18n or Ruby parse method if it failed.
# Reference https://gist.github.com/179712
module DateTimeI18nParser
module ClassMethods
def _parse_with_i18n(str, format = :default)
format ||= :default
date = self._strptime(str, I18n.translate("#{self.name.downcase}.formats.#{format}")) || _parse_without_i18n(str)
date[:year] += increment_year(date[:year].to_i) if date[:year]
@ashrafuzzaman
ashrafuzzaman / gist:5175386
Last active December 15, 2015 00:49
Compile angularJs
var $injector = angular.injector(['ng', 'custom_directives']);
var controllerDiv = $j(wrapper.find('div[ng-controller]')[0]);
$injector.invoke(function($rootScope, $compile, $document){
$compile(controllerDiv)($rootScope);
$rootScope.$digest();
});
@ashrafuzzaman
ashrafuzzaman / gist:5520084
Last active December 17, 2015 00:19
Creating widget template like form builders
<%= header do %>
<h1>Rails widget</h1>
<% end %>
<%= widget do |w| %>
<%= w.title do %>
Title
<% end %>
<%= w.content do %>
Content
@ashrafuzzaman
ashrafuzzaman / gist:5520085
Last active December 17, 2015 00:19
Widget helper class
module WidgetHelper
def header(&block)
content_tag :div, class: 'header', &block
end
def widget(options={}, &block)
w = Widget.new(options, self)
widget_content = capture(w, &block)
content_tag :div, class: 'wrapper' do
widget_content
@ashrafuzzaman
ashrafuzzaman / gist:5520590
Created May 5, 2013 11:44
Rendered widget
<div class="header">
<h1>Rails widget</h1>
</div>
<div class="wrapper">
<h2>
Title
</h2>
<div class="content">
Content
Person.human_attribute_name("first_name") # => "First name"