Skip to content

Instantly share code, notes, and snippets.

View abass's full-sized avatar

Alex Bass abass

View GitHub Profile
@abass
abass / findZapForWebhookURL.js
Created February 11, 2020 08:57 — forked from ikbelkirasan/findZapForWebhookURL.js
Find the zap that matches a webhook URL.
{
const getNodes = zap => {
let nodes = [];
for (let nodeId in zap.nodes) {
const node = zap.nodes[nodeId];
nodes.push(node);
}
return nodes;
};
@abass
abass / git-backup.sh
Last active January 31, 2017 19:42
Use this to backup your site (preferably OctoberCMS or some file-based site) on a nightly basis via Git to your GitHub account. Problems reside with GitLab or BitBucket as last I checked, they do not allow "git push" to reside on the server, they specifically limit that for security reasons. This shell script must reside in the root of the websi…
#!/bin/sh
git checkout production && git add -A && git commit -m "Automatic Backup @ `date`" && git push
@abass
abass / SiteFormToGSheet.pyc
Created January 4, 2017 05:47
We post directly to the google spreadsheet from a custom form and do not use google forms; the code snippet below is in python and posts to the google sheet which is then captured via google sheet's doPost(e) function:
form_fields = { "fname": firstName, "lname": lastName, "title": title, ... rest of form fields to go to spreadsheet}
url = "https://script.google.com/macros/s/[your spreadsheet key]/exec"
form_data = urllib.urlencode(form_fields, doseq=True)
result = urlfetch.fetch(url=url, payload=form_data, follow_redirects=True,method=urlfetch.POST,
headers={'Content-Type': 'application/x-www-form-urlencoded'})
@abass
abass / GSheetToEmail.js
Created January 3, 2017 22:27
The script we use for sending a direct email to a client with form contents when a google form is filled out
function Initialize() {
var triggers = ScriptApp.getProjectTriggers();
for(var i in triggers) {
ScriptApp.deleteTrigger(triggers[i]);
}
ScriptApp.newTrigger("SendGoogleForm")
.forSpreadsheet(SpreadsheetApp.getActiveSpreadsheet())

Keybase proof

I hereby claim:

  • I am abass on github.
  • I am abass (https://keybase.io/abass) on keybase.
  • I have a public key whose fingerprint is 0446 AC0E 0DC9 EEB3 1415 3E14 4664 EDB2 8066 6955

To claim this, I am signing this object:

@abass
abass / How to Use
Last active August 29, 2015 14:01
Parallax Scroll in 5 Lines of jQuery
$(window).on('scroll', function() {
$('.one').parallax(0.5);
$('.two').parallax(0.6);
$('.three').parallax(0.2);
});
function facebook_shares($url){
$fql = "SELECT url, normalized_url, share_count, like_count, comment_count, ";
$fql .= "total_count, commentsbox_count, comments_fbid, click_count FROM ";
$fql .= "link_stat WHERE url = '".$url."'";
$apifql="https://api.facebook.com/method/fql.query?format=json&query=".urlencode($fql);
$fb_json=file_get_contents($apifql);
return json_decode($fb_json);
}
function read_time($text){
$words = str_word_count(strip_tags($text));
$min = floor($words / 200);
if($min === 0){
return 'min read';
}
return $min . 'min read';
}
.element {
position: relative;
top: 50%;
transform: translateY(-50%);
}
@abass
abass / 0_reuse_code.js
Created November 7, 2013 19:17
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console