Custom recipe to get macOS running from scratch, setup applications and (WordPress) developer environment. I use this gist to keep the steps required to have a functioning system after a semi-annual fresh install.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Bootstrap script for setting up a new OSX machine | |
# | |
# This should be idempotent so it can be run multiple times. | |
# | |
# Some apps don't have a cask and so still need to be installed by hand. These | |
# include: | |
# | |
# - Newton (app store) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function prefered_language( $available_languages, $http_accept_language = 'auto' ) { | |
if ( 'auto' == $http_accept_language ) { | |
// $http_accept_language = $_SERVER['HTTP_ACCEPT_LANGUAGE']; | |
$http_accept_language = isset( $_SERVER['HTTP_ACCEPT_LANGUAGE'] ) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : ''; | |
} | |
preg_match_all( '/([[:alpha:]]{1,8})(-([[:alpha:]|-]{1,8}))?' . '(\s*;\s*q\s*=\s*(1\.0{0,3}|0\.\d{0,3}))?\s*(,|$)/i', $http_accept_language, $hits, PREG_SET_ORDER ); | |
$bestlang = $available_languages[0]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* WordPress Query Comprehensive Reference. | |
* | |
* All credits go to luetkemj. Thanks! | |
* | |
* @author luetkemj <luetkemj@gmail.com> | |
* @author s3rgiosan <me@s3rgiosan.com> | |
* | |
* @see http://codex.wordpress.org/Class_Reference/WP_Query#Parameters |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@each $font-face in | |
"MyFont-Regular", | |
"MyFont-Bold", | |
"MyFont-Medium" { | |
@font-face { | |
font-family: $font-face; | |
font-style: normal; font-weight: normal; | |
src: font-url('#{$font-face}.eot'); | |
src: font-url('#{$font-face}.eot?#iefix') format('embedded-opentype'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html { | |
-moz-osx-font-smoothing: grayscale; | |
-webkit-font-smoothing: antialiased; | |
text-rendering: optimizeLegibility; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="container"> | |
<ul> | |
<li id="pink">Pink</li> | |
<li id="salmon">Salmon</li> | |
<li id="blue">Blue</li> | |
<li id="green">Green</li> | |
<li id="red">Red</li> | |
</ul> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript: (function() { | |
var root = angular.element(document.getElementsByTagName('html')); | |
var watchers = []; | |
var attributes = []; | |
var attributes_with_values = []; | |
var elements = []; | |
var elements_per_attr = []; | |
var scopes = []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
* $.preload() function for jQuery – http://mths.be/preload | |
* Preload images, CSS and JavaScript files without executing them | |
* Script by Stoyan Stefanov – http://www.phpied.com/preload-cssjavascript-without-execution/ | |
* Slightly rewritten by Mathias Bynens – http://mathiasbynens.be/ | |
* Note that since this script relies on jQuery, the preloading process will not start until jQuery has finished loading. | |
*/ | |
jQuery.preload = function(array) { | |
var length = array.length, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MIT License | |
// @return {float} a random number between min and max | |
function getRandom(min, max) { | |
return Math.random() * (max - min) + min; | |
} | |
// @return {integer} a random int between min and max | |
function getRandomInt(min, max) { | |
return Math.floor(Math.random() * (max - min + 1) + min); |
NewerOlder