- shell into vagrant box -
vagrant ssh
- install MySQL server -
sudo apt-get install mysql-server mysql-client
- open mysql -
sudo mysql -u root -p
- create project database -
CREATE DATABASE sublime;
- import sql -
mysql -u root -p sublime < sublime.sql
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
/** | |
* Resize image on the fly | |
* | |
* @param int $attachment_id Attachment ID | |
* @param int $width Width | |
* @param int $height Height | |
* @param boolean $crop Crop or not | |
* | |
* @return string|bool URL of resized image, original file if error | |
*/ |
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
/** | |
* Flatten a nested array and combine/crawl by specified property | |
*/ | |
flattenByProp (arr, prop) { | |
var flatten = function (arr) { | |
return arr.reduce(function (flat, toFlatten) { | |
// combine items on this level | |
var combo = flat.concat(toFlatten); |
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 node | |
require('shelljs/global'); | |
// Prevent committing of debug configurations | |
console.log('Performing pre-commit tests...'); | |
if (!which('git')) { | |
echo('Sorry, this script requires git'); | |
process.exit(1); |
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
# Use PHP to output robots.txt to avoid accidentally indexing staging sites | |
RewriteRule ^robots\.txt$ robots.php [NC,L] |
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
// This could be used for detecting other things theoretically | |
if(!('backgroundBlendMode' in document.body.style)) { | |
// No support for background-blend-mode | |
var html = document.getElementsByTagName('html')[0]; | |
html.className = html.className + ' no-background-blend-mode'; | |
} |
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
var base = '/'; | |
switch (location.pathname){ | |
case base + 'contact': | |
console.log('you are viewing the contact page'); | |
break; | |
} |
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
var ExampleView = Backbone.View.extend({ | |
el: '.example', | |
events: function(){ | |
var action = (Modernizr.touch) ? 'touchend' : 'click', | |
events = {}; | |
events[ action + ' .btn'] = 'doSomething'; |
A tricky way to have responsive "read more"/accordion content.
A Pen by Isaac Rankin on CodePen.
NewerOlder