Skip to content

Instantly share code, notes, and snippets.

View brandonhenricks's full-sized avatar

Brandon Henricks brandonhenricks

View GitHub Profile
@karol-majewski
karol-majewski / App.tsx
Last active May 13, 2022 22:18
Generic React components in TypeScript
import * as ReactDOM from 'react-dom';
import { List } from '../components';
ReactDOM.render(
<List
items={[1, 2, 3]}
renderItem={item => <li key={item}>{item.toPrecision(3)}</li>}
wrapper={({ children }) => <ul>{children}</ul>}
/>,
@tinotriste
tinotriste / gist:5328087
Last active December 20, 2018 19:16
Shopify: Theme liquid tags for Facebook Open Graph
<!-- Find Current URL for og:url tag
https://github.com/joshuacc/Shopify-Snippets/blob/master/find-current-url.liquid -->
{% assign current_url = '' %}
{% case template %}
{% when 'page' %}
{% assign current_url = page.url %}
{% when 'blog' %}
{% assign current_url = blog.url %}
{% when 'article' %}
{% assign current_url = blog.url %}
@senky
senky / lazy_javascript.js
Last active December 11, 2015 06:29
Along with idea of responsive design, we have discovered, that there are many accompanying problems with it's usage. One of them lays in small hardware resources hidden under the hood of mobile or other portable devices. This small object uses simple hack to make JS load whenever wanted, and parsed whenewer wanted, too. This means, you can make …
var ljs = {
/**
* Loads defined script as plain text
*/
load: function (script_name) {
// pretty well known, right?
var s = document.createElement('script');
// wait! Watch this - the whole hack lays in this line.
// In fact, you do not need to use evil eval() to load JS before,
// and parse it on demand. You can load it as plain text, and
@necolas
necolas / _todo.md
Created June 30, 2012 18:07
Grunt tasks to process HTML files and produce a deploy directory of optimized files
  • Avoid reprocessing the same block in different HTML files.
  • Throw warning when processing a different block to an existing destination file. Hashing will avoid collisions, but introduce confusion.
  • Add file versioning for inline media and CSS images.
  • Avoid need for 'usemin' task - get the replacement element pattern from the first/last HTML element in actual block being replaced. Added benefit of preserving other attributes that may exist (e.g. title, media).

Acknowledgements: This is an adaption of some of Mickael Daniel's work on h5bp/node-build-script