Skip to content

Instantly share code, notes, and snippets.

View ashrafuzzaman's full-sized avatar

A.K.M. Ashrafuzzaman ashrafuzzaman

View GitHub Profile
@ashrafuzzaman
ashrafuzzaman / bootstrap.sh
Last active May 17, 2017 05:06
Git scripts
myssid=$(iwgetid -r)
if [[ $myssid == "NewsCred Inc" ]]; then
echo "In office"
/bin/bash -l -c '/home/jitu/Software/pycharm/bin/pycharm.sh' %f &
gnome-terminal --maximize --working-directory=/home/jitu/projects/marketingplatform
else
echo "Out of office"
fi
<div>A.K.M. Ashrafuzzaman</div>
<div>Lead Software Engineer</div>
<div><a href="http://www.newscred.com/" target="_blank">NewsCred</a></div>
<div><br></div>
<div>(M) 880-175-5592433</div>
<div><a href="https://twitter.com/ashrafuzzaman" target="_blank">Twitter</a>&nbsp;|&nbsp;<a
href="http://jitu-blog.blogspot.com/" target="_blank">Blog</a>&nbsp;|&nbsp;<a
href="https://www.facebook.com/ashrafuzzaman.jitu" target="_blank">Facebook</a></div>
<div><br></div>
<div><font color="#ff0000">Check out The&nbsp;<a href="http://newscred.com/theacademy" target="_blank">Academy</a>,
@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: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
# 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]