Skip to content

Instantly share code, notes, and snippets.

@bzerangue
bzerangue / transform.php
Created March 22, 2012 21:42
PHP: XSLT Transformation
<?php
// You instantiating the XSLTProcessor - libXSLT
$xmlProc = new XsltProcessor();
// Your XSLT Stylesheet for transforming XML
$xslt = new DomDocument();
$xslt -> load("example.xsl");
// This prepares the XSLT for transform
$xmlProc -> importStylesheet($xslt);
@bzerangue
bzerangue / get-google-map.xsl
Created March 24, 2012 17:30
[XSLT] Easily add a Google Map to your website.
<?xml version="1.0" encoding="UTF-8"?>
<!--
Name: Get Google Map
Version: 1.5
Changes: added in label parameter and now works with Nick Dunn's Map Location Field v3
Author: Brian Zerangue <brian.zerangue@gmail.com>
URL: http://symphony-cms.com/downloads/xslt/file/25937/
====================
Description:
@bzerangue
bzerangue / geocode.xsl
Created March 24, 2012 18:10
[XSLT] Geocode an address based off Google Maps Geocoding service.
<?xml version="1.0" encoding="UTF-8"?>
<!--
Name: Geocode
Version: 1.0
Author: Brian Zerangue <brian.zerangue@gmail.com>
Description:
===============
Geocode an address based off Google Maps Geocoding service.
@bzerangue
bzerangue / os-startup.scpt
Created March 30, 2012 04:00
This is an OS X Startup script. Open AppleScript Editor, add this script in AppleScript Editor, and save this script first as type Script. Then run Save As, and save as type Application
-- check to see if internet connection is available before running script
set intnt to do shell script "ping -c 1 google.com; echo -n"
set paras to number of paragraphs in intnt
if paras < 5 then
else
tell application "Dropbox" to launch
delay 3
tell application "/Users/username/Workflows/DropboxAltStarter.app" to launch
delay 3
end if
@bzerangue
bzerangue / recursively-rename-extension.sh
Created April 16, 2012 00:31
Terminal Script: Recursively rename or change file extensions (this example, changing extension from .html to .php)
find . -name "*.html" | while read i; do mv "$i" "${i%.html}.php"; done
@bzerangue
bzerangue / gist:2491702
Created April 25, 2012 17:59 — forked from ericdfields/gist:1717578
Bash convert all your .css to .scss in one line (because you've seen the light)
# From .css to .scss
for f in *.css; do sass-convert -F css -T scss $f ${f%%.*}.scss; done
@bzerangue
bzerangue / recursive-css-to-scss.sh
Created April 25, 2012 20:20
RECURSIVELY Bash convert all your .css to .scss in one line
find . -name "*.css" | while read i; do sass-convert -F css -T scss "$i" "${i%.*}.scss"; done
@bzerangue
bzerangue / whichquery.sass
Created April 26, 2012 15:49 — forked from wyattdanger/whichquery.sass
Determine which media query breakpoint you're on
body::before
content: '< 480px'
@media only screen and (min-width: 480px)
body::before
content: '480px < 600px'
@media only screen and (min-width: 600px)
body::before
content: '600px < 768px'
@bzerangue
bzerangue / html2md-with-pandoc.sh
Created April 26, 2012 23:14
RECURSIVELY Bash convert all your html to markdown files (with Pandoc)
find . -name "*.ht*" | while read i; do pandoc -f html -t markdown "$i" -o "${i%.*}.md"; done
@bzerangue
bzerangue / haml2html-recursive.sh
Created April 26, 2012 23:16
RECURSIVELY Bash convert HTML to HAML; and also HAML to HTML; sass-convert from css to scss AND back from scss to css
find . -name "*.haml" | while read i; do haml -f xhtml -q "$i" "${i%.*}.html"; done