Skip to content

Instantly share code, notes, and snippets.

View kevnk's full-sized avatar

Kevin K kevnk

View GitHub Profile
@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

@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:
@devudit
devudit / Helper.php
Created May 6, 2016 10:35
Dynamic body classes in laravel
<?php
// Create A class Helper as app/Helper/Helper.php
use Illuminate\Support\Facades\Request;
Class Helper {
public static function getBodyClass() {
$body_classes = [ ];
$class = "";
@mvriel
mvriel / pre-commit.php
Created May 16, 2011 20:14
Pre-commit hook for DocBlox
#!/usr/bin/php
<?php
echo PHP_EOL;
// output a little introduction
echo '>> Starting unit tests' . PHP_EOL;
// get the name for this project; probably the topmost folder name
$projectName = basename(getcwd());
@DanielWright
DanielWright / README.md
Created November 16, 2011 18:51
Simple font-smoothing in Internet Explorer

The filter and zoom rules in the sample stylesheet above will apply a smoothing/blurring effect to text elements. In the sample stylesheet, these rules are applied to all headers, paragraphs, list items, and table cells, but in practice, you will want to tailor the application of the smoothing effect to only those elements rendering with significant aliasing.

Nota Bene: the filter appears to place an overflow: hidden-style block around the elements being smoothed, so do not apply these rules directly to elements that need to scroll, or which contain absolutely positioned elements that appear outside the boundaries of the element itself.

<?php
class Color
{
/**
* Convert a hex color to RGB.
*
* @param string $hex #BADA55
* @return array{int,int,int} [186, 218, 85]
*/
@demonbane
demonbane / makeapp.sh
Created July 5, 2011 20:05
Create a Fluid-style app launcher for single-window Chrome instances on OSX
#!/bin/sh
echo "What should the Application be called (no spaces allowed e.g. GCal)?"
read inputline
name="$inputline"
echo "What is the url (e.g. https://www.google.com/calendar/render)?"
read inputline
url="$inputline"
@daz
daz / generate-silence.sh
Created October 23, 2017 07:25
Generate a silent AAC audio with ffmpeg
ffmpeg -f lavfi -i anullsrc=r=11025:cl=mono -t <number of seconds> -acodec aac out.m4a
@eykd
eykd / esv_ranges.py
Created February 24, 2011 14:14
Data structure defining the number of verses in every chapter of every book of the ESV bible.
# list of books, padded with None to be 1-indexed
# each book is a tuple with name of book, # of chapters, [number of verses in each chapter]
# the list with the number of verses per chapter is padded to make it 1-indexed
passage_data = [None,
('Genesis', 50, [None, 31, 25, 24, 26, 32, 22, 24, 22, 29, 32, 32, 20, 18, 24, 21, 16, 27, 33, 38, 18, 34, 24, 20, 67, 34, 35,
46, 22, 35, 43, 55, 32, 20, 31, 29, 43, 36, 30, 23, 23, 57, 38, 34, 34, 28, 34, 31, 22, 33, 26]),
('Exodus', 40, [None, 22, 25, 22, 31, 23, 30, 25, 32, 35, 29, 10, 51, 22, 31, 27, 36, 16, 27, 25, 26, 36, 31, 33, 18, 40, 37, 21,
43, 46, 38, 18, 35, 23, 35, 35, 38, 29, 31, 43, 38]),
('Leviticus', 27, [None, 17, 16, 17, 35, 19, 30, 38, 36, 24, 20, 47, 8, 59, 57, 33, 34, 16, 30, 37, 27, 24, 33, 44, 23, 55, 46, 34]),
('Numbers', 36, [None, 54, 34, 51, 49, 31, 27, 89, 26, 23, 36, 35, 16, 33, 45, 41, 50, 13, 32, 22, 29, 35, 41, 30, 25, 18, 65,
@andrewrcollins
andrewrcollins / mix_tint_tone_shade.php
Last active February 24, 2024 18:52
Color Mixing, Tint, Tone, and Shade in PHP
<?php
/**
* mix
*
* @param mixed $color_1
* @param mixed $color_2
* @param mixed $weight
*
* @return void