Skip to content

Instantly share code, notes, and snippets.

View shkm's full-sized avatar
😵‍💫
Stumbling through life, one exception at a time.

Jamie Schembri shkm

😵‍💫
Stumbling through life, one exception at a time.
View GitHub Profile
@shkm
shkm / active_admin.css.scss
Last active December 29, 2015 20:28
Restyle Rich to fit in with Active Admin's style.
form .cke_chrome {
display: inline-block;
width: calc(80% - 2px);
box-shadow: none;
// border color needs additional specificity as it is set on .cke_n.cke_chrome
border-color: #c9d0d6 !important;
}
.cke_chrome, .cke_inner {
@include rounded;
@shkm
shkm / _mixins.scss
Created October 21, 2013 15:24
Retina sprites. Given a normal and retina sprite map, along with the name of the sprite, this does magic things. Requires a retina mixin, such as https://gist.github.com/shkm/7085706
// Include normal and retina sprites. Requires retina mixin.
@mixin retina-sprite($map-1x, $map-2x, $sprite, $dimensions: true) {
$position-1x: sprite-position($map-1x, $sprite);
background: sprite-url($map-1x) $position-1x no-repeat;
@if $dimensions {
@include sprite-dimensions($map-1x, $sprite);
}
@include retina {
@shkm
shkm / _mixins.scss
Last active December 26, 2015 03:28
Retina mixin
@mixin retina {
@media only screen and (-webkit-min-device-pixel-ratio: 2),
only screen and (min-resolution: 192dppx) {
@content;
}
}
@shkm
shkm / gist:7008739
Created October 16, 2013 14:36
Multi-size favicon.ico with ImageMagick
convert favicon-16x16.png favicon-32x32.png favicon.ico
@shkm
shkm / gist:6165319
Created August 6, 2013 15:06
Basehold.it bookmarklet
javascript:(function(){l=document.createElement('link');l.rel='stylesheet';l.href='http://basehold.it/24';document.head.appendChild(l);})();
@shkm
shkm / conosle.js
Created May 22, 2013 13:17
Brings conosle to Chrome. See http://youtu.be/MVw8N3hTfCI
conosle = console;
@shkm
shkm / mirror.exclude
Last active December 17, 2015 01:49
Bootable OS X backups with rsync. Based on Nicolas Gallagher's script (http://nicolasgallagher.com/mac-osx-bootable-backup-drive-with-rsync/).
- .Spotlight-*/
- .Trashes
- .DocumentRevisions-*/
- /.dbfseventsd
- .fseventsd/
- /tmp/*
- /Network/*
- /cores/*
- /afs/*
- /automount/*
@shkm
shkm / ValidatingModel.php
Last active December 16, 2015 12:19
Laravel self-validating model. Child models need only extend `getRules()` and return their own rules array. Loosely based on Jeffrey Way's (https://tutsplus.com/lesson/validating-with-models-and-event-listeners/).
<?php
abstract class ValidatingModel extends \Eloquent
{
public $errors;
public static function boot()
{
parent::boot();
@shkm
shkm / register_post_type.sublime-snippet
Created May 3, 2012 16:49 — forked from ninnypants/cpt.sublime-snippet
register_post_type snippet for Sublime Text 2
<snippet>
<content><![CDATA[
register_post_type('${1:slug}', array(
${2:'labels' => array(
${3:'name' => _x( '${4:Plural Name}', '${5:translation context}', '${6:translation domain}' ),}
${8:'singular_name' => _x( '${9:Singular Name}', '${10:translation context}', '${6:translation domain}' ),}
${11:'add_new' => _x( '${12:Add new}', '$9', '${6:translation domain}' ),}
${13:'add_new_item' => __( '$12 $9', '${6:translation domain}' ),}
${14:'edit_item' => __( 'Edit ${15:$9}', '${6:translation domain}' ),}
${16:'new_item' => __( 'New ${17:$9}', '${6:translation domain}' ),}
@shkm
shkm / gist:1821872
Created February 14, 2012 00:30
Add Seperator to Dock in OS X
defaults write com.apple.dock persistent-apps -array-add '{ "tile-type" = "spacer-tile"; }' && killall Dock