Skip to content

Instantly share code, notes, and snippets.

View we4tech's full-sized avatar

Hossain Khan we4tech

View GitHub Profile
@we4tech
we4tech / site.conf
Created August 15, 2014 10:41
Rails4 and Angularjs with Nginx + Proxy cache
upstream puma {
server 127.0.0.1:8080 fail_timeout=0;
}
proxy_cache_path /home/of/all/evil/stuffs/as/shared/tmp/cache/nginx levels=1:2 keys_zone=api-cache:10m max_size=1000m inactive=200m;
# HTTP server
#
server {
@we4tech
we4tech / app_logrotate.conf
Last active August 29, 2015 14:05
Rails or ruby application logrotate configuration.
"/path/to/application/current/log/*.log" {
daily
su user_name group_name
size 5M
missingok
rotate 5
compress
delaycompress
notifempty
copytruncate
@we4tech
we4tech / state.rb
Last active August 29, 2015 14:15
Countries with states
class State
STATES = {
'US' => {
'AL' => 'Alabama',
'AK' => 'Alaska',
'AZ' => 'Arizona',
'AR' => 'Arkansas',
'CA' => 'California',
'CO' => 'Colorado',
'CT' => 'Connecticut',
@we4tech
we4tech / Gemfile
Created February 28, 2015 17:45
Gemfile for Rails 4.2.0 with Angularjs, Jasmin, Rspec, FactoryGirl and so on.
source 'https://rubygems.org'
source 'https://rails-assets.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.0'
# Use mysql as the database for Active Record
gem 'mysql2'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
@we4tech
we4tech / ext-xdebug.ini
Created March 11, 2015 16:54
Xdebug with PHP
[xdebug]
zend_extension="/usr/local/opt/php55-xdebug/xdebug.so"
xdebug.default_enable=1
xdebug.remote_enable=1
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
xdebug.remote_autostart=1
xdebug.idekey="PHPSTORM"
@we4tech
we4tech / stage.js
Created August 6, 2011 08:21
Using node-control i've built my deployment script, it was fun and easy to do and go :)
var control = require('control'),
script = process.argv[1],
perform = control.perform,
task = control.task;
var ProjectConfig = {
rootDir: 'staging',
git: 'git://github.com/we4tech/restaurant-review.git',
branch: 'master',
serverPort: 4000
@we4tech
we4tech / deploy.js
Created August 11, 2011 18:56
Using node-control i've built my deployment script, it was fun and easy to do and go :)
var control = require('control'),
script = process.argv[1],
perform = control.perform,
task = control.task;
/**
* Project related configuration
*/
var ProjectConfig = {
// Keep it simple word so we could use it for Rails environment too.
@we4tech
we4tech / autoclosing-issue
Created November 18, 2011 22:10
Haml issue with autoclosing
-- HAML
#new_schedule{title: "Add Schedule"}
%form
%fieldset.ui-helper-reset
%label{for: "tab_title"} Title
%input#tab_title.ui-widget-content.ui-corner-all{type: "text", name: "tab_title", value: ""}
-- Converted HTML
<div id='new_schedule' title='Add Schedule'>
<form>
@we4tech
we4tech / faq_item_spec.rb
Created November 28, 2011 13:55
spec for faq item model
require 'spec_helper'
describe FaqItem do
context 'validations' do
it 'should validate the presence of question' do
should validate_presence_of(:question)
end
it 'should validate the presence of answer' do
@we4tech
we4tech / faq_item_spec.rb
Created November 28, 2011 13:58
spec for faq item model
require 'spec_helper'
describe FaqItem do
context 'validations' do
it 'should validate the presence of question' do
should validate_presence_of(:question)
end
it 'should validate the presence of answer' do