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
from __future__ import print_function | |
import pickle | |
import os.path | |
from googleapiclient.discovery import build | |
from google_auth_oauthlib.flow import InstalledAppFlow | |
from google.auth.transport.requests import Request | |
from googleapiclient.http import MediaFileUpload, MediaIoBaseUpload | |
# If modifying these scopes, delete the file token.pickle. | |
SCOPES = ['https://www.googleapis.com/auth/drive'] |
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
from selenium import webdriver | |
from selenium.webdriver.common.keys import Keys | |
print("Enter wp username") | |
user = str(input()) | |
print("Enter wp password") | |
passw = str(input()) | |
print("Enter field numbers") | |
num = int(input()) | |
driver = webdriver.Chrome('chromedriver') |
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 | |
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
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
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
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
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
# 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
$( document ).on('turbolinks:load', function() { | |
(function($){ | |
$.fn.autoResize = function(options) { | |
// Just some abstracted details, | |
// to make plugin users happy: | |
var settings = $.extend({ | |
onResize : function(){}, |