Skip to content

Instantly share code, notes, and snippets.

View maliakmal's full-sized avatar
🎯
Focusing

Mohammad Ali Akmal maliakmal

🎯
Focusing
  • Solo Freelance Nomad
  • Online most of the time
View GitHub Profile
// POST to - https://ogramwebapi.azurewebsites.net/api/v1/CreateWE
// payload
{
"WorkExperienceDetails":{
"new_yearsofexperience":4,
"new_hourlyrate":20,
"new_shiftrate":20,
"new_weeklyrate":20,
@extends('layouts.scaffold')
@section('main')
<div class="row-fluid">
<div class="span12">
<h1>Create Article</h1>
</div>
</div>
<div class="row-fluid">
@maliakmal
maliakmal / files.rb
Created March 28, 2013 08:03
HABTM to HM
class Contact < ActiveRecord::Base
acts_as_citier
has_many :contacts_service_types
has_many :service_types, :through=>:contacts_service_types
end
class ContactsServiceType < ActiveRecord::Base
@maliakmal
maliakmal / error
Created February 25, 2013 08:38
Errors installing openerp
hyderab1@hyderabadwaley.com [~/www/openerp]# python setup.py install
running install
error: can't create or remove files in install directory
The following error occurred while trying to add or remove files in the
installation directory:
[Errno 30] Read-only file system: '/usr/lib/python2.6/site-packages/test-easy-install-16014.write-test'
The installation directory you specified (via --install-dir, --prefix, or
ali@Ali-PC:~/projects/fltctr$ cap deploy
* 2013-02-21 12:37:49 executing `deploy'
* 2013-02-21 12:37:49 executing `deploy:update'
** transaction: start
* 2013-02-21 12:37:49 executing `deploy:update_code'
updating the cached checkout on all servers
executing locally: "git ls-remote git@bitbucket.org:aliakmal/fltctr.git HEAD"
command finished in 4722ms
* executing "if [ -d /var/www/html/fltctr.com/shared/cached-copy ]; then cd /var/www/html/fltctr.com/shared/cached-copy && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard 2833daae8c6b627b03941ebacb3ae2b837fc47b5 && git clean -q -d -x -f; else git clone -q git@bitbucket.org:aliakmal/fltctr.git /var/www/html/fltctr.com/shared/cached-copy && cd /var/www/html/fltctr.com/shared/cached-copy && git checkout -q -b deploy 2833daae8c6b627b03941ebacb3ae2b837fc47b5; fi"
servers: ["166.78.22.204"]
@maliakmal
maliakmal / deploy.rb
Created February 20, 2013 08:51
deploy.rb
require "bundler/capistrano"
set :application, "fltctr"
set :repository, "git@bitbucket.org:aliakmal/fltctr.git"
set :scm, :git
# set :scm, :git # You can set :scm explicitly or Capistrano will make an intelligent guess based on known version control directory names
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
# Define your server here
server "166.78.22.204", :web, :app, :db, primary: true
@maliakmal
maliakmal / bundle install
Created February 7, 2013 18:18
RUBY RACER ERROR
Installing therubyracer (0.11.3) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
checking for main() in -lpthread... yes
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
def self.has_none?(user)
accessible_records_by(user).empty?
end
@maliakmal
maliakmal / App_Controller_Action
Created September 21, 2012 05:33
holidays controller
<?php
class App_Controller_Action extends Zend_Controller_Action {
protected $type;
function getDatesBetween2Dates($startTime, $endTime) {
$day = 86400;
$format = 'Y-m-d';
$startTime = strtotime($startTime);
@maliakmal
maliakmal / ability.rb
Created July 12, 2012 07:40
Ability Model
if user.has_role? :station_manager,:any
can :read, Station do |station|
Station.owned_by_station_manager(user).where(id: station.id).any?
end
can [:read,:confirm,:invoice], Flight do |flight|
Flight.owned_by_station_manager(user).where(id: flight.id).any?
end
can :read, Product do |product|
Product.owned_by_station_manager(user).where(id: product.id).any?
end