Skip to content

Instantly share code, notes, and snippets.

View mavieth's full-sized avatar

Michael Vieth mavieth

  • Denver, CO
View GitHub Profile
@mavieth
mavieth / gist:f2d9b7451fc23090f73f
Created March 29, 2016 00:44
BannerMetaTag.php
<!-- Chrome, Firefox OS and Opera -->
<meta name="theme-color" content="#4285f4">
<!-- Windows Phone -->
<meta name="msapplication-navbutton-color" content="#4285f4">
<!-- iOS Safari -->
<meta name="apple-mobile-web-app-status-bar-style" content="#4285f4">
$white: #ffffff;
$black: #000000;
$red50: #ffebee;
$red100: #ffcdd2;
$red200: #ef9a9a;
$red300: #e57373;
$red400: #ef5350;
$red500: #f44336;
$red600: #e53935;
$red700: #d32f2f;
#!/bin/bash
# in ~/Sites directory
for D in *; do
if [ -d "${D}" ]; then
wp --path=$D/ core update
wp --path=$D/ theme update --all
wp --path=$D/ plugin update --all
fi
done
#!/bin/bash -e
# First do apt-get update
/usr/bin/sudo apt-get update
# Then the upgrade
/usr/bin/sudo apt-get -y upgrade
# Finally rpi-update
/usr/bin/sudo rpi-update
sudo find wp-content/ -type f -exec chmod 644 {} \;
sudo find -type f -exec chmod 644 {} \;
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
$ mkdir myproject
$ cd myproject
$ virtualenv venv
New python executable in venv/bin/python
Installing distribute............done.
Now, whenever you want to work on a project, you only have to activate the corresponding environment. On OS X and Linux, do the following:
$ . venv/bin/activate
let smartAlbums = PHAssetCollection.fetchAssetCollectionsWithType(.SmartAlbum, subtype: .AlbumRegular, options: nil) // Here you can specify Photostream, etc. as PHAssetCollectionSubtype.xxx
smartAlbums.enumerateObjectsUsingBlock( {
if let assetCollection = $0.0 as? PHAssetCollection {
print("album title: \(assetCollection.localizedTitle)")
// One thing to note with Smart Albums is that collection.estimatedAssetCount can return NSNotFound if estimatedAssetCount cannot be determined. As title suggest this is estimated. If you want to be sure of number of assets you have to perform fetch and get the count like:
let assetsFetchResult = PHAsset.fetchAssetsInAssetCollection(assetCollection, options: nil)
let numberOfAssets = assetsFetchResult.count
let estimatedCount = (assetCollection.estimatedAssetCount == NSNotFound) ? -1 : assetCollection.estimatedAssetCount
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache"
rm -rf ~/Library/Developer/Xcode/DerivedData
rm -rf ~/Library/Caches/com.apple.dt.Xcode
<?php
/**
* Class Name: wp_bootstrap_navwalker
* GitHub URI: https://github.com/twittem/wp-bootstrap-navwalker
* Description: A custom WordPress nav walker class to implement the Bootstrap 3 navigation style in a custom theme using the WordPress built in menu manager.
* Version: 2.0.4
* Author: Edward McIntyre - @twittem
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt