Skip to content

Instantly share code, notes, and snippets.

@legenderrys
legenderrys / SyncServerFoldertoDropbox.php
Created June 9, 2014 14:53
Remote Folder to Dropbox folder
<?php
// Set the timezone so filenames are correct
date_default_timezone_set('Europe/London');
// Backup all files in public_html apart from the gz
$siteroot = "/path/to/backup";
$dropbox_email='dropbox@email'; //Dropbox username
$dropbox_pass='pass'; // Dropbox password
@legenderrys
legenderrys / leaflet-ajax-links.js
Created June 17, 2014 21:27
Load Leaflet marker links with Ajax into a div container without page refreash
@legenderrys
legenderrys / form.html
Last active August 29, 2015 14:08
form validator
<h3>header</h3>
<form method="POST" id="myform" action="echo/html">
<label for="foo">First Name:</label>
<input type="input" id="foo">
<br>
<label for="bar">Last Name:</label>
<input type="input" id="bar">
<br>
<label for="baz">Email:</label>
@legenderrys
legenderrys / tableTojson.html
Created August 19, 2015 22:28
convert table element to json object
<table>
<thead>
<tr>
<th>Name</th>
<th>Hobby</th>
<th>Favorite Music</th>
</tr>
</thead>
<tbody>
<tr class="tabledata">
function donationformToJSON(){
var sections = $('td[class*="BBListingHeading"]');
collection = [];
sections.each(function(id,elem){
var section_name = $(elem).text();
var labels = $(elem).parents('tbody').find('label');
//compile dictionary for each form element
//separated by sections
jsonobject = {}
labels.each(function(id,lel){
@legenderrys
legenderrys / jinja_test.py
Last active September 9, 2017 00:47
Jinja Custom extension for moving block content into the footer
from flask import Flask,render_template, render_template_string
from pprint import pprint
'''HTML JINJA TEMPLATE'''
# create a new test.html file with the jinjaTemplateString below to view the issue.
jinjaTemplateString = '''
<html> <head></head> <body> <h1>Test template</h1>
{% push 'js' %} ABC {% endpush %}
{% push 'js' %} XYZ {% endpush %}
@legenderrys
legenderrys / Google form processor
Last active March 17, 2018 07:29
Converts google form into JSON form response object
var db = {}
var gf = _docs_flag_initialData['docs-seu'].replace('/edit','/formResponse');
var labels = [...document.querySelectorAll('.freebirdFormviewerViewItemsItemItem')];
var form = labels.forEach(function(elb,i){
//find labelname
var labelname = elb.querySelector('.freebirdFormviewerViewItemsItemItemTitle');
labelname = labelname.textContent;
db[labelname] = {};