Skip to content

Instantly share code, notes, and snippets.

View jh3's full-sized avatar
🔥

Joe Hassick jh3

🔥
View GitHub Profile
@jh3
jh3 / drupal-quick-dump.sh
Created November 22, 2012 19:21 — forked from timmillwood/drupal-quick-dump.sh
Script to dump Drupal database structure, but exclude data from massive/unneeded tables.
#!/bin/bash
# usage: drupal-quick-dump user host database
USER="$1"
HOST="$2"
DB="$3"
DATE=`date +%Y%m%d`
# Get User Password
echo "Please provide the password for ${USER} on db ${DB} hosted at ${HOST}:"

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
@jh3
jh3 / setup-drupal.sh
Created August 26, 2013 01:41
Quickly setup a drupal site for local development
#!/usr/bin/env bash
# For OSX. Assumes you have drush, git, mysql, apache, and Chrome installed.
# Usage: ./setup-drupal.sh cool-app 7
SITE=$1
VERSION=$2
DIR="~/Development/sites/$SITE"
@jh3
jh3 / hosts-manager.sh
Created August 26, 2013 01:42
Shell script to manage /etc/hosts. I forget where I found this.
#!/usr/bin/env bash
# Idea and interface taken from https://github.com/macmade/host-manager
path="/etc/hosts"
addusage="Usage: `basename $0` -add host address"
remusage="Usage: `basename $0` -remove host"
case "$1" in
-add)
if [ $# -eq 3 ]; then
if [[ -n $(grep "^$3.*[^A-Za-z0-9\.]$2$" ${path}) ]]; then
@jh3
jh3 / helpers.coffee
Last active August 29, 2015 14:03
AngularJS filter of Drupal's truncate_utf8() function
app.filter "truncateText", ->
(string, maxLength, wordsafe = false, addEllipsis = false, minWordsafeLength = 1) ->
ellipsis = ''
maxLength = Math.max(maxLength, 0)
minWordsafeLength = Math.max(minWordsafeLength, 0)
# Remove HTML tags
string = string.replace(/<(?:.|\n)*?>/gm, '')
# No truncation needed, so don't add ellipsis, just return.