Skip to content

Instantly share code, notes, and snippets.

View kurtschlatzer's full-sized avatar

Kurt Schlatzer kurtschlatzer

View GitHub Profile
@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);
#!/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
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 / 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">
@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,
@kurtschlatzer
kurtschlatzer / shopping-redirect.php
Created September 14, 2016 17:06 — forked from BFTrick/shopping-redirect.php
Change the Continue Shopping link on the WooCommerce Cart page
<?php
/**
* Return the permalink of the shop page for the continue shopping redirect filter
*
* @param string $return_to
* @return string
*/
function my_woocommerce_continue_shopping_redirect( $return_to ) {
return get_permalink( wc_get_page_id( 'shop' ) );
}
@kurtschlatzer
kurtschlatzer / a-better-setup-for-git.md
Created September 15, 2016 00:08 — forked from nepsilon/a-better-setup-for-git.md
A better setup for Git — First published in fullweb.io issue #46

A better setup for Git

Git default configuration is good but it can be personalized to improve your workflow efficiency. Here are some good lines to put in your ~/.gitconfig:

# The basics, who you commit as:
[user]
  name = John Doe
  email = john@doe.org