Skip to content

Instantly share code, notes, and snippets.

@justb81
justb81 / getcomposer.sh
Last active April 28, 2020 11:20
get composer programmatically
#!/bin/sh
EXPECTED_SIGNATURE=$(curl -sS https://composer.github.io/installer.sig)
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_SIGNATURE=$(php -r "echo hash_file('SHA384', 'composer-setup.php');")
if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]
then
>&2 echo 'ERROR: Invalid installer signature'
rm composer-setup.php
@justb81
justb81 / matchingstyles.js
Created May 19, 2016 14:48
get used styles from document fragment. useful for styleguide components to see which styles will be used
/**
* get used styles from document
* @return {Promise}
*/
var MatchingStyles = function(document, cssCodeElement) {
var cssRules = [];
return new Promise(function(resolve, reject){
/**
* walk through all cssrules and push matching rules to list