Skip to content

Instantly share code, notes, and snippets.

(function($,sr){
// debouncing function from John Hann
// http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/
// via Paul Irish
// https://www.paulirish.com/2009/throttled-smartresize-jquery-event-handler/
var debounce = function (func, threshold, execAsap) {
var timeout;
return function debounced () {
{
"success": true,
"page": 1,
"page_max": 1,
"results_per_page": 20,
"count": 5,
"results": [
{
"Id": 12,
"Title": "Blog Post 5",
<div class="container" style="max-width:100%;padding:0;">
<div class="row">
{% for i, post in su.page("/my-blog").posts|reverse|slice(0,4) %}
<div class="col-md-6">
{% if i == 0 %}<img data-cke-saved-src="{{ post.featuredImage.ratio(315, 215) }}" src="{{ post.featuredImage.ratio(315, 215) }}" style="margin-bottom: 20px;">{% endif %}
<h4><a data-cke-saved-href="{{ su.page.url }}" href="{{ su.page.url }}">{{ post.title }}</a></h4>
<p>{{ post.description ?: post.content|striptags|pretty_truncate(200) }}</p>
</div>
{% endfor %}
</div>
import * as React from 'react'
import {Link} from 'react-router-dom'
import {default as styled, ThemeInterface} from '../../styled-components'
interface ButtonProps {
theme?: ThemeInterface
className?: string
action?: any
modalId?: string
disabled?: boolean
@su-narthur
su-narthur / caniuse_updates.md
Last active August 10, 2017 14:29
Get a caniuse update weekly
$ npm install -g caniuse-cmd # install the caniuse cli
$ caniuse grid layout | mail -s test [email protected] # send a test email
$ crontab -e # open crontab

After opening crontab, add this line and save:

0 5 * * Sun /bin/bash -li -c "/usr/local/bin/caniuse grid layout | mail -s Update [email protected]"

@su-narthur
su-narthur / svg-extract.py
Last active May 9, 2022 13:29
Convert SVG font to individual SVG files
# http://helpfulsheep.com/2015-03-25-converting-svg-fonts-to-svg/
import sys, re
if len(sys.argv) < 2:
print 'Usage: python {} webfont-file.svg'.format(sys.argv[0])
sys.exit()
with open(sys.argv[1], 'r') as r:
lines = r.read().split('\n')
glyphs = [x for x in lines if '<glyph' in x]
@su-narthur
su-narthur / minify-middleware.php
Created October 18, 2016 18:52 — forked from frugan-dev/middleware.php
Silex minify HTML middleware
<?php
$app->after(function (\Symfony\Component\HttpFoundation\Request $request, \Symfony\Component\HttpFoundation\Response $response) use ($app) {
if ($app['debug']) return;
$search = array(
'#\/\*.+?\*\/#', // /* JS Comments */
'#^\s+\/\/.+#m', // // JS Comments
'/<!--.+?-->/', // <!-- HTML Comments -->
'/\n/',