Skip to content

Instantly share code, notes, and snippets.

View bloqhead's full-sized avatar

Daryn St. Pierre bloqhead

View GitHub Profile

JIC Stylesheets

a JS-in-CSS stylesheet format and mixin guideline

Everything in a JIC stylesheet revolves around the use of a very special pair of brackets that look like this ${}. They open with a ${, and close with a }. In a JIC stylesheet everything outside these brackets is CSS, and everything inside these brackets is JavaScript.

You might think of it as a CSS stylesheet that functions like a JavaScript template string, because in the end that's how it will be interpreted.

When you combine CSS and JavaScript this way, you are able to leverage the 100% of the features of CSS, and add 100% of the features of JavaScript to it. There are many ways CSS and JavaScript can communicate, using a JIC-formatted stylesheet is one of the most flexible and succinct syntaxes for expressing your styles. And makes it very easy to extend the features of CSS by writing simple JavaScript functions called called 'JIC mixins'.

To show you what this idea is all, about let's look at a small example. Here is

@tomhodgins
tomhodgins / cibc2csv.js
Last active December 4, 2021 21:24
Paste this function into your JS console on CIBC's online banking website to scrape your account ledger into a CSV formatted file the browser can save that can be imported into Excel
function cibc2csv() {
var table = document.querySelector('table.smart-account')
var csv = ''
var head = []
var row = []
// read header cells
table.querySelectorAll('thead th').forEach(th => {
head.push(`${trim(th.textContent)}`)
})

QSS - Simple Query Syntax

The goal of QSS is to define a simple syntax for specifying element queries by adding a new ending part between a CSS selector list and the block of rules that help define the breakpoints when those rules are to apply.

Normally in CSS you have something like this:

selectorList { block }
@Soben
Soben / wp.sh
Created October 25, 2017 16:25
WP-CLI Find/Replace URLs
wp search-replace "oldurl" "newurl" --precise --all-tables --skip-themes --skip-plugins
@zentala
zentala / formatBytes.js
Created September 27, 2017 11:57
Convert size in bytes to human readable format (JavaScript)
function formatBytes(bytes,decimals) {
if(bytes == 0) return '0 Bytes';
var k = 1024,
dm = decimals || 2,
sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
}
// Usage:
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active December 15, 2025 22:37
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@shvchk
shvchk / Install Signal Desktop as a standalone app.md
Last active November 8, 2017 08:20
Deprecated, please use official standalone Signal Desktop: https://signal.org
@mojaray2k
mojaray2k / instafeedjsaccess.md
Last active February 10, 2025 17:40
Getting Instagram Access Token for http://intafeedjs.com

#Use this URL to get your client authorized for Instafeed.JS plugin for Instagram.

  1. First login into your Instargam account
  2. Then go to https://www.instagram.com/developer/
  3. At the top click on the Button that says "Manage Clients".
  4. If you have not Register a new client.
  5. Fill out everything and where it says redirect url put this url: http://instafeedjs.com
  6. Then on the security tab make sure you uncheck "Disable implicit OAuth"
  7. Finally use this link to authoruize Instafeed. Where it says "[Client ID]" replace that including the brackets with your clientID from instagram:
  8. https://instagram.com/oauth/authorize/?client_id=[Client ID]&redirect_uri=http://instafeedjs.com&amp;response_type=token
@bloqhead
bloqhead / sass-globbing-fix.sh
Created January 5, 2016 17:45
There is a bug with `sass-globbing` version 1.1.1 that throws an error when it comes to file paths. To fix it, run the following command in your command line app of choice. To give props, see this comment on Github: https://github.com/chriseppstein/sass-globbing/issues/19#issuecomment-66501914
gem uninstall sass-globbing
gem install sass-globbing -v 1.1.0
@lmarkus
lmarkus / README.MD
Last active November 27, 2025 15:56
Extracting / Exporting custom emoji from Slack

Extracting Emoji From Slack!

Slack doesn't provide an easy way to extract custom emoji from a team. (Especially teams with thousands of custom emoji) This Gist walks you through a relatively simple approach to get your emoji out.

If you're an admin of your own team, you can get the list of emoji directly using this API: https://api.slack.com/methods/emoji.list. Once you have it, skip to Step 3

HOWEVER! This gist is intended for people who don't have admin access, nor access tokens for using that list.

Follow along...