This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
require 'uri' | |
def create | |
@subscription = current_user.subscriptions.build(subscription_params) | |
if @subscription.save | |
create_subscription_with_api(@subscription) | |
else | |
redirect_to request.referrer, notice: 'Some error caused in the payment gateway.' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
require 'uri' | |
def create | |
@subscription = current_user.subscriptions.build(subscription_params) | |
if @subscription.save | |
create_subscription_with_api(@subscription) | |
else | |
redirect_to request.referrer, notice: 'Some error caused in the payment gateway.' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$( document ).on('turbolinks:load', function() { | |
(function($){ | |
$.fn.autoResize = function(options) { | |
// Just some abstracted details, | |
// to make plugin users happy: | |
var settings = $.extend({ | |
onResize : function(){}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this wont support recurring subscription | |
def create | |
@subscription = current_user.subscriptions.build(subscription_params) | |
if @subscription.save | |
create_subscription(@subscription, debug=true) #paypal checkout sdk | |
else | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
url = window.location.href; | |
paramName = 'myparam'; | |
paramValue = $(this).val(); | |
var pattern = new RegExp('('+paramName+'=).*?(&|$)') | |
var newUrl = url.replace(pattern,'$1' + paramValue + '$2'); | |
var n=url.indexOf(paramName); | |
alert(n) | |
if(n == -1){ | |
newUrl = newUrl + (newUrl.indexOf('?')>0 ? '&' : '?') + paramName + '=' + paramValue | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var main = (function($, window, document){ | |
function object(){ | |
// scripts | |
return{ | |
object : object, | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def task_overalltime(timelines) | |
array = timelines.split(',').map{ |x| x.to_datetime} | |
nd_time = array.length.even? ? '' : '+' | |
array = array.reverse | |
rec_difference = 0 | |
array.each_with_index do |val, ind| | |
if ind.odd? | |
next_ind = ind - 1 | |
rec_difference = rec_difference + (val.to_time - array[next_ind].to_time).to_i.abs if array[next_ind].present? | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
before_filter :set_cache_headers | |
private | |
def set_cache_headers | |
response.headers["Cache-Control"] = "no-cache, no-store" | |
response.headers["Pragma"] = "no-cache" | |
response.headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# show orgins for a repository | |
git remote -v | |
#delete a remote of a repository | |
git remote rm origin #where origin is the remote | |
#pushing to master with branches |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#chrome driver installation | |
link: https://chromedriver.chromium.org/ | |
#download the chromedriver respective to the version of your chrome webbrowser | |
#unzip the downloaded file and move "chromedriver.exe" to a folder or a working directory | |
#run the "chromedriver.exe" before the automated script runs. | |
#selenium module installation using pip | |
pip install selenium | |