Skip to content

Instantly share code, notes, and snippets.

View kurtschlatzer's full-sized avatar

Kurt Schlatzer kurtschlatzer

View GitHub Profile
xmlin = prompt(); // view-source:biochemistri.es/sitemap1.xml
parser = new DOMParser();
xmlDoc=parser.parseFromString(xmlin,"text/xml");
xmlDoc.querySelectorAll('loc')[0].remove();
posts = xmlDoc.querySelectorAll('loc');
postlist = [];
for (i=0;i<posts.length;i++) {postlist.push(posts[i].innerHTML)};
copy(postlist.join('\t')); // Chronological list of all posts as .tsv
/* Tested with jquery-1.7.2.min.js */
$(window).load(function () {
"use strict";
/* Cycles XML file on successful load via ajax and parses contents into HTML */
function parseXML(xml) {
/* Variable declaration */
var outHTML = "", employee, sId, sFirstname, sSurname, sAddress;
/*
Folder structure :
/frontend <-- AngularJS app
/dist <-- Production ready files
/assets
/css
/js
index.html
/src <-- Source files
# Was asked how I keep my zshrc config sync'd between my computers with Dropbox
# Add a new directory in your Dropbox (or use an existing one)
mkdir -p ~/Dropbox/ohmyzsh
# move existing file to Dropbox
mv ~/.zshrc ~/Dropbox/ohmyzsh/zshrc
# symlink file back to your local directory
ln -s ~/Dropbox/ohmyzsh/zshrc ~/.zshrc
@kurtschlatzer
kurtschlatzer / time-ago.php
Created July 17, 2015 22:26
PHP time-ago function
function timeAgo($time_ago) {
$cur_time = time();
$time_elapsed = $cur_time - $time_ago;
$seconds = $time_elapsed ;
$minutes = round($time_elapsed / 60 );
$hours = round($time_elapsed / 3600);
$days = round($time_elapsed / 86400 );
$weeks = round($time_elapsed / 604800);
$months = round($time_elapsed / 2600640 );
$years = round($time_elapsed / 31207680 );
@kurtschlatzer
kurtschlatzer / viewport-dimensions.html
Last active October 6, 2015 21:18
Use this to view the current browser window viewport dimensions -- useful for responsive design prototyping and debugging. minimal CSS absolute-positioned indicator box for height / width in pixels. Changes on resize.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Document Dimension Indicator</title>
<style type="text/css">
#dimbox {
position: absolute;
@kurtschlatzer
kurtschlatzer / snippet.js
Created August 13, 2012 19:18 — forked from hjerpbakk/snippet.js
Optimised async loading of cross-domain scripts, added js.async=true
(function(doc, script) {
var js,
fjs = doc.getElementsByTagName(script)[0],
add = function(url, id) {
if (doc.getElementById(id)) {return;}
js = doc.createElement(script);
js.src = url;
js.async=true;
id && (js.id = id);
fjs.parentNode.insertBefore(js, fjs);
@kurtschlatzer
kurtschlatzer / resource-hints.html
Created October 24, 2015 02:45 — forked from nepsilon/resource-hints.md
Resource Hints
<!-- pre-DNS resolve a domain -->
<link rel="dns-prefetch" href="//widget.com">
<!-- pre-connect to a domain HTTP endpoint -->
<link rel="preconnect" href="//cdn.example.com">
<!-- pre-fetch a resource, here an
image needed on the page -->
<link rel="prefetch" href="//example.com/logo.jpg" as="image">
#!/bin/bash
#
# Watch current directory (recursively) for file changes, and execute
# a command when a file or directory is created, modified or deleted.
#
# Written by: Senko Rasic <senko.rasic@dobarkod.hr>
#
# Requires Linux, bash and inotifywait (from inotify-tools package).
#
# To avoid executing the command multiple times when a sequence of
@kurtschlatzer
kurtschlatzer / user.sql
Created July 21, 2016 20:26 — forked from davidsommer/user.sql
Magento User data
SELECT
t.cid AS mid,
t.email_ AS email,
t.group_id_ AS group_id,
GROUP_CONCAT(t.fname_ SEPARATOR '') AS fname,
GROUP_CONCAT(t.lname_ SEPARATOR '') AS lname,
t.street_ AS street,
GROUP_CONCAT(t.city_ SEPARATOR '') AS city,
GROUP_CONCAT(t.state_code_ SEPARATOR '') AS state_code,
GROUP_CONCAT(t.zip_ SEPARATOR '') AS zip,