Skip to content

Instantly share code, notes, and snippets.

View robmcalister's full-sized avatar
🐢
Slowly, but surely.

Robbie McAlister robmcalister

🐢
Slowly, but surely.
View GitHub Profile
@robmcalister
robmcalister / hideemail
Created August 11, 2013 23:53
Hide Email With Entities
#!/usr/bin/env ruby
email = STDIN.read
url_email = email.gsub(/./) { |c| '%' + c.unpack('H2' * c.size).join('%').upcase }
html_email = url_email[1..-1].split(/%/).collect { |c| sprintf("&#%03d;", c.to_i(16)) }.join
print "<a href=\"mailto:#{url_email}\">#{html_email}</a>"
@robmcalister
robmcalister / parse_xlsx.php
Created August 28, 2013 21:36 — forked from searbe/parse_xlsx.php
.xlsx File Parser Just some code that unzips the .xlsx file and then parses through the xml to return an array of rows and columns. Stolen from https://gist.github.com/3284011
<?php
/**
* I had to parse an XLSX spreadsheet (which should damn well have been a CSV!)
* but the usual tools were hitting the memory limit pretty quick. I found that
* manually parsing the XML worked pretty well. Note that this, most likely,
* won't work if cells contain anything more than text or a number (so formulas,
* graphs, etc ..., I don't know what'd happen).
*/
@robmcalister
robmcalister / _ide_helper.php
Created August 28, 2013 22:03 — forked from barryvdh/_ide_helper.php
Laravel 4 IDE helper for autocompletions
<?php
/**
* An helper file for Laravel 4, to provide autocomplete information to your IDE
* Generated with https://github.com/barryvdh/laravel-ide-helper
*
* @author Barry vd. Heuvel <[email protected]>
*/
exit('Only to be used as an helper for your IDE');
class App extends Illuminate\Support\Facades\App{
@robmcalister
robmcalister / css_button
Last active December 22, 2015 11:38
CSS Button
.button {
background: -moz-linear-gradient(top, #c96ceb, #a741b0);
background: -webkit-gradient(linear, 0 0, 0 100%, from(#c96ceb), to(#a741b0));
border: solid #a741b0 0px;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
box-shadow: 0px 1px 3px #666666;
-moz-box-shadow: 0px 1px 3px #666666;
-webkit-box-shadow: 0px 1px 3px #666666;
.clearfix:after {
content: "";
display: block;
clear: both;
visibility: hidden;
font-size: 0;
height: 0;
}
.clearfix {
@robmcalister
robmcalister / scrollbars.css
Created September 30, 2013 15:38
Always show scrollbars on DOM elements set to overflow: scroll; Yes, even on OS X Lion.
::-webkit-scrollbar {
-webkit-appearance: none;
width: 7px;
}
::-webkit-scrollbar-thumb {
border-radius: 4px;
background-color: rgba(0,0,0,.5);
-webkit-box-shadow: 0 0 1px rgba(255,255,255,.5);
}
@robmcalister
robmcalister / box_model.css
Created October 18, 2013 21:15
box model the right way
/* apply a natural box layout model to all elements */
*, *:before, *:after {
-moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;
}
@robmcalister
robmcalister / partial.js
Created November 11, 2013 16:46
Partial function binding in javascript (SOTJSN)
Function.prototype.partial = function() {
var fn = this, args = Array.prototype.slice.call(arguments);
return function() {
var arg = 0;
for (var i = 0; i < args.length && arg < arguments.length; i++) {
if (args[i] == undefined) {
args[i] = arguments[arg++];
}
}
return fn.apply(this, args);
@robmcalister
robmcalister / overflow_truncate_ellipsis.css
Created December 11, 2013 14:58
Overflow truncate with ellipsis
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
@robmcalister
robmcalister / hold.js
Last active January 3, 2016 04:59
Tap and Hold directive for angularjs (rmHold).
app.directive('rmHold', ['$timeout', function($timeout) {
return {
restrict: 'A',
link: function(scope, elem, attrs) {
var isActive = false;
var currentTimeout = null;
var startCoords = {
x: null,
y: null
}