Skip to content

Instantly share code, notes, and snippets.

@bzerangue
bzerangue / script.rb
Last active March 12, 2018 20:27
Contentful Import CMA Script - Ruby Example
# This Open Beer Database data is made available under the Open Database License.
# Any rights in individual contents of the database are licensed under the Database Contents License.
# http://openbeerdb.com/
require 'contentful/management'
require 'csv'
# function to create slugs
def slugify(str)
str.ljust(100).strip.gsub(/[\s\t\r\n\f]/,'_').gsub(/\W/,'').downcase
@bzerangue
bzerangue / build.js
Created March 12, 2018 12:26
contentful metalsmith example with Handlebars, Handlebars-Layouts (for template inheritance)
const glob = require('glob')
const Metalsmith = require('metalsmith')
const layouts = require('metalsmith-layouts')
const assets = require('metalsmith-assets')
const sass = require('metalsmith-sass')
const markdown = require('metalsmith-markdown')
const dataMarkdown = require('metalsmith-data-markdown')
const contentful = require('contentful-metalsmith')
const handlebars = require('handlebars')
@bzerangue
bzerangue / saxon-examples-serverpilot.md
Last active March 9, 2018 02:01
Saxon C PHP Examples for Saxon/C 1.1.0 for ServerPilot

REPLACE your YOURSERVERPILOTUSER with your username for the app. AND also, REPLACE APPNAME with your app name.

sudo cp -R /usr/local/Saxonica/Saxon-HEC1.1.0/samples /srv/users/YOURSERVERPILOTUSER/apps/APPNAME/public/php
sudo chown -R YOURSERVERPILOTUSER:YOURSERVERPILOTUSER /srv/users/YOURSERVERPILOTUSER/apps/APPNAME/public/php
@bzerangue
bzerangue / xsltExamples.php
Last active March 9, 2018 01:54
Updated xsltExamples.php that comes with Saxon C 1.1 CE - this fixes the hard-coded extension_dir used setProperty and registerPHPFunction around the userFunctionExample around line 50-59
<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Saxon/C API design use cases</title>
</head>
<body>
<?php
$saxonExtPath = ini_get('extension_dir') . "/saxon";
@bzerangue
bzerangue / Vagrantfile
Last active March 9, 2018 00:37
vagrant ubuntu1404 build base for serverpilot (add serverpilot via "manual install")
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64"
# Disable automatic box update checking. If you disable this, then
@bzerangue
bzerangue / 20180308-sg-update.mjml
Last active March 8, 2018 19:50
Small Group Update (using MJML)
<mjml>
<mj-head>
<mj-title>Small Groups Update: March 2018</mj-title>
<mj-font name="Alice" href="https://fonts.googleapis.com/css?family=Alice" />
<mj-font name="Roboto" href="https://fonts.googleapis.com/css?family=Roboto:400,700" />
<mj-attributes>
<mj-all font-family="Roboto, Helvetica, Arial, sans-serif" padding="0" />
<mj-text font-weight="400" font-size="14" color="#000000" line-height="21px" />
</mj-attributes>
</mj-head>
@bzerangue
bzerangue / disable-suspend.md
Last active January 8, 2021 11:19
Disable Sleep/Suspend and WiFi in Ubuntu 16.04 LTS

On Ubuntu 16.04 LTS, I successfully used the following to disable suspend:

sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

And this to re-enable it:

sudo systemctl unmask sleep.target suspend.target hibernate.target hybrid-sleep.target

@bzerangue
bzerangue / import.scpt
Created January 12, 2016 20:12
Applescript: Import Apple Notes to Evernote
tell application "Notes"
set theMessages to every note
repeat with thisMessage in theMessages
set myTitle to the name of thisMessage
set myText to the body of thisMessage
@bzerangue
bzerangue / .htaccess
Created December 23, 2015 04:41
Bolt CMS .htaccess
# Set the default handler.
DirectoryIndex index.php index.html index.htm
# Prevent directory listing
Options -Indexes
# Make sure MultiViews is disabled if available.
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
@bzerangue
bzerangue / sermons.rss.xml.twig
Last active October 21, 2022 15:01
Twig Example template for RSS feed
<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
<channel>
<title>Sermons at Irving Bible Church</title>
<!-- Need to update with appropriate Sermon RSS Feed location -->
<atom:link href="http://irvingbible.org/sermons/rss.xml" rel="self" type="application/rss+xml"></atom:link>
<link>http://www.irvingbible.org/sermons/</link>
<description>Weekly morning sermons from Irving Bible Church in Irving, TX. For all of our sermon archives, please visit http://www.irvingbible.org/sermons.</description>
<lastBuildDate>Tue, 01 Dec 2015 00:00:00 -0600</lastBuildDate>
<language>en-us</language>