Skip to content

Instantly share code, notes, and snippets.

View rajputvai's full-sized avatar

Vaibhav Rajput rajputvai

View GitHub Profile
require 'fileutils'
res = `which passenger-config`
if $?.exitstatus != 0
puts "`passenger-config` not found, Passenger might not be installed.\n`gem install passenger -v 6.0.4`.\n"
exit(-1)
end
path = "#{Dir.pwd}/nginx"
module ActiveSupport
class TimeZone
def parse(str, now=now)
parts = Date._parse(str, false)
return if parts.empty?
if parts[:hour] > 23
return str
end
time = Time.new(
parts.fetch(:year, now.year),
scheduler = angular.module('scheduler',[
'templates',
'ngRoute'
]
scheduler.config(["$sceDelegateProvider", ($sceDelegateProvider) ->
$sceDelegateProvider.resourceUrlWhitelist([
'self',
'https://b4ustaging.amagi.tv/**'])
])
$scope.masters =
'status': 0
'masters': [
{
'date': '2015-01-01'
'daypart': 'Morning'
'signature': 'HULZT_25_030'
'duration': 30
'spot_count': 2
}
@rajputvai
rajputvai / gist:e61af268fdc3bdd584d1
Created January 23, 2015 05:35
FactoryGirl Association
# models/user.rb
class User < ActiveRecord::Base
has_many :user_brands
end
# models/user_brand.rb
class UserBrand < ActiveRecord::Base
belongs_to :user
end
@rajputvai
rajputvai / gist:1eebb9f688637c89c558
Created July 8, 2014 11:55
params["carousels"]
{"-1"=>{"0"=>{"0"=>"6", "1"=>"12"}}, "1"=>{"0"=>{"0"=>"3", "1"=>"24"}, "1"=>{"0"=>"2", "1"=>"12"}}, "2"=>{"0"=>{"0"=>"3", "1"=>"24"}, "1"=>{"0"=>"2", "1"=>"12"}}, "3"=>{"0"=>{"0"=>"3", "1"=>"24"}, "1"=>{"0"=>"2", "1"=>"12"}}, "4"=>{"0"=>{"0"=>"3", "1"=>"24"}, "1"=>{"0"=>"2", "1"=>"12"}}, "6"=>{"0"=>{"0"=>"3", "1"=>"48"}, "1"=>{"0"=>"1", "1"=>"12"}}, "7"=>{"0"=>{"0"=>"6", "1"=>"24"}, "1"=>{"0"=>"3", "1"=>"12"}}}
ERROR: Tam city is not configured for telecast city: RestofMaharashtra for caption id: 2G90ZRRMBG70, caption: Mortel GR Sugarcane ERROR: Tam city is not configured for telecast city: RestofMaharashtra for caption id: 2G90ZRRMBG70, caption: Mortel GR Sugarcane ERROR: Tam city is not configured for telecast city: RestofMaharashtra for caption id: 2G90ZRRMBG70, caption: Mortel GR Sugarcane ERROR: Tam city is not configured for telecast city: RestofMaharashtra for caption id: 2G90ZRRMBG70, caption: Mortel GR Sugarcane ERROR: Tam city is not configured for telecast city: RestofMaharashtra for caption id: 2G90ZRRMBG70, caption: Mortel GR Sugarcane ERROR: Tam city is not configured for telecast city: RestofMaharashtra for caption id: 2G90ZRRMBG70, caption: Mortel GR Sugarcane ERROR: Tam city is not configured for telecast city: RestofMaharashtra for caption id: 2G90ZRRMBG70, caption: Mortel GR Sugarcane ERROR: Tam city is not configured for telecast city: RestofMaharashtra for caption id: 2G90ZRRMBG70, caption: Mort
@rajputvai
rajputvai / gist:109bd46667a0ec80115e
Created May 26, 2014 13:40
$(form).serialize()
utf8=%E2%9C%93&authenticity_token=62yDiiIQENNOKzaj2LFuXYWGdWh2ibrNv%2FDCaJtvOOc%3D&headend%5Bdevice_id%5D=xcvdfv45&headend%5Bname%5D=sdsf&headend%5Bdescription%5D=sdsdf&headend%5Bprimary%5D=true&headend%5Bcity%5D=dfdsf&headend%5Bstate%5D=sdsad&headend%5Baddress%5D=dsfsfsd&headend%5Bregion_id%5D=29
# Use this file to easily define all of your cron jobs.
#
# It's helpful, but not entirely necessary to understand cron before proceeding.
# http://en.wikipedia.org/wiki/Cron
# Example:
#
require 'rails/all'
set :output, "#{Rails.root}/log/cron_log.log"
users = User.where('name IS NULL')
users.each do |user|
# Some api call which will retrive name of the user based on user email
name = API.getUserName user.email
if name.blank?
next
else
user.update_attribute(:name, name)
end
end