Skip to content

Instantly share code, notes, and snippets.

View scottboms's full-sized avatar
👀

Scott Boms scottboms

👀
View GitHub Profile
@marcedwards
marcedwards / high-dpi-media.css
Last active March 2, 2025 20:24
A CSS media query that captures almost all high DPI aware devices.
/* ---------------------------------------------------------- */
/* */
/* A media query that captures: */
/* */
/* - Retina iOS devices */
/* - Retina Macs running Safari */
/* - High DPI Windows PCs running IE 8 and above */
/* - Low DPI Windows PCs running IE, zoomed in */
/* - Low DPI Windows PCs and Macs running Firefox, zoomed in */
/* - Android hdpi devices and above */
@timkelty
timkelty / default.html
Created August 28, 2012 19:12
Using Stash for parsing "needles" out of content fields (similar to techniques using Copee Pastee/LG Replace)
{!-- embed page template --}
{embed="site/_page"
hide_site_title="{embed:hide_site_title}"
body_class="p-default"
}
{!-- get channel data --}
{exp:channel:entries
limit="1"
entry_id="{embed:entry_id}"
@KuraFire
KuraFire / rgbaa.scss
Created September 13, 2012 21:18
More dynamic, oldIE-compatible SCSS function for rgba
@function rgbaa($args...) {
// rgbaa(#FFF, .5)
@if length($args) == 2 {
$hex: nth($args, 1);
$alpha: nth($args, 2);
@if $oldIE == 1 {
@return rgb(red($hex), green($hex), blue($hex));
} @else {
@return rgba(red($hex), green($hex), blue($hex), $alpha);
@objectivehtml
objectivehtml / gist:3761912
Created September 21, 2012 14:48
Manipulate the no_results tag
// Add this to your module tag
if($no_results_prefix = $this->EE->TMPL->fetch_param('no_results_prefix'))
{
if(preg_match('/\\'.LD.'if '.$no_results_prefix.'no_results\\'.RD.'.*\\'.LD.'\\/if\\'.RD.'/us', $this->EE->TMPL->tagdata, $matches))
{
$this->EE->TMPL->no_results = $this->EE->TMPL->parse_variables_row($matches[0], array(
$no_results_prefix.'no_results' => 1
));
}
{exp:query sql="
SELECT md.entry_id, cd.field_id_56, md.col_id_48
FROM exp_matrix_data AS md
LEFT JOIN exp_playa_relationships AS pr
ON md.entry_id = pr.parent_entry_id
LEFT JOIN exp_channel_data AS cd
ON pr.child_entry_id = cd.entry_id
WHERE md.field_id = 123
AND md.row_order = 1
GROUP BY md.entry_id
@adamyeats-zz
adamyeats-zz / script.js
Last active April 7, 2017 21:18
Typekit Hack
/*
This small hack loads fonts from the Typekit webfontloader (https://github.com/typekit/webfontloader)
contextually, effectively "patching" in a new font if a media query is fired.
You need to have 2 seperate kits on Typekit, one for your main fonts, and another for the fonts you want
when the media query is fired.
Improvements or suggestions welcome!
@ddemaree
ddemaree / _retina.scss
Created April 26, 2013 20:49
Example Sass mixin for a "bulletproof" Hi-DPI media query
@mixin retina($ratio: 1.5) {
$dpi: $ratio * 96;
$opera-ratio: $ratio * 100;
@media only screen and (-webkit-min-device-pixel-ratio: #{$ratio}),
only screen and ( -o-min-device-pixel-ratio: '#{$opera-ratio}/100'),
only screen and ( min-resolution: #{$dpi}dpi),
only screen and ( min-resolution: #{$ratio}dppx) {
@content;
}
@croxton
croxton / entries_archive.md
Last active April 8, 2018 01:30
Sort a list of entries by year and then by month
	{exp:stash:set_list name="entries" parse_tags="yes"}
		{exp:channel:entries channel="my_channel" orderby="date" sort="desc" dynamic="no" limit="999"}
		    {stash:title}{title}{/stash:title}
		    {stash:date_day}{entry_date format="%d"}{/stash:date_day}
		    {stash:date_month}{entry_date format="%m"}{/stash:date_month}
		    {stash:date_year}{entry_date format="%Y"}{/stash:date_year}
		    {stash:date_sort}{entry_date format="%Y-%F"}{/stash:date_sort}
		    {stash:date_machine}{entry_date}{/stash:date_machine}
		{/exp:channel:entries}

{/exp:stash:set_list}

@subtleGradient
subtleGradient / Behavior.framer.js
Last active July 28, 2017 17:27
Simple Behavior sheet system for FramerJS. Allows you to apply pre-defined behaviors to your layers by changing the layer name. by Thomas Aylott (http://subtlegradient.com) Copyright 2013 Facebook. All rights reserved. MIT License.
function Behavior(PSD){
var _BehaviorNames = Object.keys(Behavior.behaviors)
.filter(function(BehaviorName){ return !!Behavior.behaviors[BehaviorName].namingPattern });
Object.keys(PSD).forEach(function(layerName){
var layer = PSD[layerName];
_BehaviorNames.forEach(function(BehaviorName){
var match = layerName.match(Behavior.behaviors[BehaviorName].namingPattern);
try {
@koenbok
koenbok / qc-framer.js
Created May 14, 2014 15:04
QC Spring Value Converter
var QcValueConverter = {
tensionFromQcValue: function(qcValue) {
return (qcValue - 30.0) * 3.62 + 194.0;
},
qcValueFromTension: function(tension) {
return (tension - 194.0) / 3.62 + 30.0;
},
frictionFromQcValue: function(qcValue) {