Skip to content

Instantly share code, notes, and snippets.

View satyatechsavy's full-sized avatar

Satya kalluri satyatechsavy

View GitHub Profile
@satyatechsavy
satyatechsavy / gist:9cebd2f5e8b85753bd2e
Created February 22, 2016 11:47
AWS EB-Extension to install PhantomJS
files:
"/opt/elasticbeanstalk/hooks/appdeploy/pre/04_install_phantomjs":
mode: "000777"
owner: root
group: root
content: |
#!/usr/bin/env bash
set -xe
@satyatechsavy
satyatechsavy / gist:7675140
Created November 27, 2013 12:49
Convert anything to Boolean
class String
def to_bool
return true if self == true || self =~ (/(true|t|yes|y|1)$/i)
return false if self == false || self.blank? || self =~ (/(false|f|no|n|0)$/i)
raise ArgumentError.new("invalid value for Boolean: \"#{self}\"")
end
end
<a onclick='return load_more_faqs();'> Load more FAQs</a>
function load_more_faqs {
$.ajax({url:'more_faqs',
success:function(data) { $('#faqs').append(data);}
});
}
# Sample localization file for English. Add more files in this directory for other locales.
# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
ru:
activerecord:
errors:
models:
subscription:
attributes:
email:
class Api::Foobar
include HTTParty
base_uri 'http://demo.foobar.es/vweb/xml'
GLOBAL_OPTIONS = {edad: 'anciano', farmacovigilancia: false, deportista: false, administrativas: false}
def initialize(user)
@user = user
end
def assign_variable
@Four_Season_Set_Channel = params[:channel]
respond_to do |format|
format.js {
render(:update) { |page| page.alert @Four_Season_Set_Channel }
}
end
end
@satyatechsavy
satyatechsavy / windows8_notification.rb
Created April 5, 2012 05:29
Notification to Windows8
require 'windows8_system'
require 'fetch_windows8_access_token'
require 'net/http'
require 'net/https'
class Windows8Notification < Windows8System
def self.process(device_uri,message)
puts "iha"
device_uri = "https://db3.notify.windows.com/?token=AgUAAAADoGlaM0THo74Q%2bJP7MkgBEJzYC7OyTwh59QmECe9MgwfwGSWLsMhkG%2bHF3JI3q3gySjc3keErqcwWYCN9Qwi2z7TdCMnYGb30huMkKrzB54%2fH73vxrYzp36SQScHazJA%3d"
require 'httparty'
class ItunesVerification
include HTTParty
base_uri 'https://sandbox.itunes.apple.com'
default_params :output => 'json'
format :json
def self.verify_apple_receipt(apple_receipt)
post('/verifyReceipt', :body=>{'receipt-data' => apple_receipt})