Skip to content

Instantly share code, notes, and snippets.

View ejangi's full-sized avatar
😎
Totally addicted to Docker.

James ejangi

😎
Totally addicted to Docker.
View GitHub Profile
@ejangi
ejangi / titlize
Created December 31, 2013 06:44
This is a OS X command line tool I keep in my $PATH to quickly Fix titles when copy/pasting for blog posts etc.
#!/usr/bin/env ruby
options = Array.new
string = String.new
titlized = String.new
pbcopy = "cbcopy"
if RUBY_PLATFORM =~ /darwin/ then
pbcopy = "pbcopy"
end
@ejangi
ejangi / usedspace
Created December 31, 2013 06:49
This is a OS X command line script to get the percentage of HDD space used
#!/bin/sh
PERCENT=`df / | grep / | awk '{ print $5}' | sed 's/%//g'`
echo "$PERCENT% HDD space used"
@ejangi
ejangi / perma
Created December 31, 2013 06:50
This is a OS X command line tool to create a permalink from a string
#!/usr/bin/env ruby
options = Array.new
string = String.new
permalink = String.new
pbcopy = "cbcopy"
if RUBY_PLATFORM =~ /darwin/ then
pbcopy = "pbcopy"
end
@ejangi
ejangi / vertical-align.css
Created January 14, 2014 09:35
Vertical Align anything with this short snippet of CSS3
.vertical-align {
position: relative;
top: 50%;
-webkit-transform: translateY(-50%);
-moz-transform: translateY(-50%);
-o-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}
@ejangi
ejangi / blur.css
Created January 14, 2014 09:38
Blur an element using CSS Filters (e.g. image).
.blur {
-webkit-filter: blur(12px);
-webkit-transform: translate3d(0, 0, 0);
}
@ejangi
ejangi / debounce.js
Created February 6, 2014 20:57
Debounce Function
// Returns a function, that, as long as it continues to be invoked, will not
// be triggered. The function will be called after it stops being called for
// N milliseconds. If `immediate` is passed, trigger the function on the
// leading edge, instead of the trailing.
function debounce(func, wait, immediate) {
var timeout;
return function() {
var context = this, args = arguments;
clearTimeout(timeout);
timeout = setTimeout(function() {
@ejangi
ejangi / AppleScript-Mount-Searchable-Network-Drive.scpt
Created September 29, 2014 04:51
AppleScript to silently Mount a Network Share and tell spotlight to index it so it is searchable
# The MIT License (MIT)
#
# Copyright (c) 2014 SU QLD
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
<FilesMatch "\.(ttf|otf|eot|woff|svg)$">
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
</FilesMatch>
<?php
// Dequeue the junky styles and scripts that plugins inject into your template:
function dequeue_doubleup_styles() {
wp_dequeue_style('stylesheet-id');
}
add_action('wp_print_styles', 'dequeue_doubleup_styles', 999);
function dequeue_doubleup_scripts() {
wp_dequeue_script('script-id');
}