Skip to content

Instantly share code, notes, and snippets.

View kevnk's full-sized avatar

Kevin K kevnk

View GitHub Profile
@kevnk
kevnk / isMobile.coffee
Last active March 15, 2017 15:00
Test for mobile via coffeescript
Site = ->
# @see: http://stackoverflow.com/a/20413768/622287
_isHighDensity: ->
((window.matchMedia && (window.matchMedia('only screen and (min-resolution: 124dpi), only screen and (min-resolution: 1.3dppx), only screen and (min-resolution: 48.8dpcm)').matches || window.matchMedia('only screen and (-webkit-min-device-pixel-ratio: 1.3), only screen and (-o-min-device-pixel-ratio: 2.6/2), only screen and (min--moz-device-pixel-ratio: 1.3), only screen and (min-device-pixel-ratio: 1.3)').matches)) || (window.devicePixelRatio && window.devicePixelRatio > 1.3))
_isRetina: ->
((window.matchMedia && (window.matchMedia('only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx), only screen and (min-resolution: 75.6dpcm)').matches || window.matchMedia('only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2/1), only screen and (min--moz-device-pixel-ratio: 2), only screen and (min-device-pixel-ratio: 2)').matches)) || (window.devicePixel
@kevnk
kevnk / 00-Premise.md
Last active August 29, 2015 14:20
Coding Style Guide

Solved

Let me start with the solution: ReactJS includes the styles inline and/or in the same file as the elements they're being used on. This removes my frustrations with multiple people working on the same SASS/LESS project.

So this is only for projects that don't follow the methodology above.

A couple frustrations

  1. Classes and IDs (more often than not) need to communicate and describe the styles they are setting, not describe what/where the element is.
@kevnk
kevnk / magento-boilerplate-cache-bust-gulpfile.js
Last active August 29, 2015 13:56
Be sure to replace `mytheme` with your theme's directory name on lines 59 and 62
var gulp = require('gulp');
var less = require('gulp-less');
var minifycss = require('gulp-minify-css');
var jshint = require('gulp-jshint');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var replace = require('gulp-replace');
@kevnk
kevnk / Default (OSX).sublime-keymap
Last active December 27, 2015 12:29
Useful Sublime Text key bindings
[
// SidebarEnhancements package enhancements
{ "keys": ["super+ctrl+r"], "command": "reveal_in_side_bar"}
, { "keys": ["super+shift+r"], "command": "side_bar_rename" }
]
@kevnk
kevnk / local.xml
Created September 19, 2013 15:56
Boilerplate Magento local.xml file
<?xml version="1.0"?>
<!--
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available through the world-wide-web at this URL:
@kevnk
kevnk / Magento Frontend Snippets.md
Last active December 22, 2015 09:49
Snippets for a Magento front-end developer doing some repeated customizations not native to default theme.

LAYOUTS

Add breadcrumbs

<reference name="breadcrumbs">
    <action method="addCrumb">
        <crumbName>Home</crumbName>
        <crumbInfo>
            <label>Home</label>

Home