Skip to content

Instantly share code, notes, and snippets.

View deadlyhifi's full-sized avatar
🥑

Tom de Bruin deadlyhifi

🥑
View GitHub Profile
@deadlyhifi
deadlyhifi / gist:a269e0401b0b8b2be30e
Created April 18, 2015 08:22
Switch Magic Trackpad Orientation

sudo defaults write com.apple.MultitouchSupport ForceAutoOrientation YES

Then do a five finger spread action on the trackpad (as if you’re invoking view desktop).

source

@deadlyhifi
deadlyhifi / press-these-keys
Created May 9, 2015 14:07
Reset terminal after timeout
Enter ~ .
@deadlyhifi
deadlyhifi / animations.scss
Last active August 29, 2015 14:25
Keyframe animations - with Bourbon, of course.
@include keyframes(floatIn) {
from {
margin-top: 15px;
}
to {
margin-top: 0;
}
}
@include keyframes(fadeIn) {
@deadlyhifi
deadlyhifi / findClassAndAddOne.js
Created July 27, 2015 04:55
Get element by class and add a class
var matches = document.querySelector("div.js-nav");
for (var i = 0; i < matches.classList.length; i++) {
matches.classList.add('TEST');
}
@deadlyhifi
deadlyhifi / menuToggle.js
Created July 27, 2015 04:57
Menu toggle
window.onload = function() {
document.getElementById("js-toggle").onclick = function () {
this.classList.toggle("is-active");
document.getElementById("js-nav").classList.toggle("is-visible");
};
};
@deadlyhifi
deadlyhifi / delete.sql
Created August 2, 2015 11:01
WP Delete Post Revisions
DELETE
FROM wp_posts
WHERE post_type = 'revision';
DELETE FROM wp_postmeta
WHERE post_id NOT IN (SELECT ID FROM wp_posts);
/**
* Remove the admin notice suggesting you to install WooThemes Helper
*/
function remove_wc_helper_notice() {
remove_action('admin_notices', 'woothemes_updater_notice');
}
add_action('init', 'remove_wc_helper_notice');
@deadlyhifi
deadlyhifi / fml.php
Created September 3, 2015 07:00
WP: Add page class to body
function body_class_adder($classes)
{
global $post;
if (isset($post)) {
$classes[] = $post->post_type . '-' . $post->post_name;
}
return $classes;
}
@deadlyhifi
deadlyhifi / timestation.js
Last active September 24, 2015 17:36
TimeStation current week hours snippet - for textexpander or something.
function getTimeStationString() {
var today = new Date();
var d = new Date();
var day = d.getDay(),
diff = d.getDate() - day + (day == 0 ? -6:1); // adjust when day is sunday
var mon = new Date(d.setDate(diff));
return 'https://www.mytimestation.com/User_Reports.asp?ReportID=20&Report_StartDate=' + formatDate(mon) + '&Report_EndDate=' + formatDate(today) + '&Report_DepartmentID=-1&ReportName=Department+Summary&ID=20&Submit=Run+Report';
find . -name \.AppleDouble -exec rm -rf {} \;