Skip to content

Instantly share code, notes, and snippets.

Avatar
🔥
busy fixing things...

Darcy Clarke darcyclarke

🔥
busy fixing things...
View GitHub Profile
@darcyclarke
darcyclarke / get-authors-from-deps.js
Created Mar 9, 2022
Get All Contributors From Dependencies
View get-authors-from-deps.js
const{ promisify } = require('util')
const Arborist = require('@npmcli/arborist')
const read = promisify(require('read-package-json'))
const arb = new Arborist({ path: '.' })
arb.loadActual().then(async tree => {
const authors = {}
const deps = []
function store (author) {
if (author.email && !authors[author.email]) {
authors[author.email] = author
@darcyclarke
darcyclarke / package.json
Last active Oct 7, 2020
npm prepublish check for package@version existence
View package.json
{
"scripts": {
"prepublish" : "[[ $(npm view $npm_package_name@$npm_package_version --silent) ]] && echo \"error: $npm_package_name@$npm_package_version exists already!\" && exit 1 || echo \"successful check: $npm_package_name@$npm_package_version does not exist already\""
}
}
@darcyclarke
darcyclarke / npm-audit.sh
Last active Oct 7, 2020
A `npm audit <pkg>` proof-of-concept in bash...
View npm-audit.sh
#!/bin/bash
PKG=package.json
DIR=npm-audit-tmp
mkdir $DIR && cd $DIR && [[ $* == *--dry-run* && -f "../$PKG" ]] && cp "../$PKG" $PKG || echo '{}' >$PKG && npm i $1 --no-audit --package-lock-only --silent; npm audit; cd ../ && rm -rf $DIR
# Installation:
# 1. copy this into a file: /usr/local/bin/npm-audit
# 2. make it executable: chmod +x /usr/local/bin/npm-audit
# Usage:
@darcyclarke
darcyclarke / inject.js
Last active Mar 24, 2020
Facebook Sponsored Ad Filter - Use this w/ your preferred script injector (ex. "CJS" on Chrome or "Code Injector" on FF)
View inject.js
// Updated & working as of March 24th, 2020
;(() => {
function removeAds() {
Array.from(document.querySelectorAll('[id^=feed_sub_title], [data-testid^=story-subtilte], [data-pagelet^=FeedUnit]'))
.map(e => {
let content = e.innerText
let dynamic = Array.from(e.querySelectorAll('span:not([data-content=""])'))
.filter(e => e.style.display != 'none')
.map(e => {
let hidden = window.getComputedStyle(e, ':before').getPropertyValue('content')
View keybase.md

Keybase proof

I hereby claim:

  • I am darcyclarke on github.
  • I am darcyclarke (https://keybase.io/darcyclarke) on keybase.
  • I have a public key ASD4yo0sZAq8GW7-sMMPykFBSvT1luv3MwlvIVmXrBeRLQo

To claim this, I am signing this object:

@darcyclarke
darcyclarke / jquery.missing.selector.js
Created May 27, 2016
A jQuery filter selector for ":missing" (ie. opposite of ":contains")
View jquery.missing.selector.js
/*!
*
* jQuery :missing Plugin
* http://darcyclarke.me/articles/development/find-elements-that-dont-contain-a-string/
*
* Copyright 2016, Darcy Clarke
* Do what you want license
*
*/
jQuery.expr[':'].missing = function(elem, index, match) {
@darcyclarke
darcyclarke / jquery.animate.floats.js
Last active Mar 7, 2017
jQuery plugin for animating elements with floats
View jquery.animate.floats.js
/*!
* Animate Floats jQuery Plugin
* http://darcyclarke.me/articles/development/animate-float-positions-in-jquery-1-5/
*
* Copyright 2016, Darcy Clarke
* Do what you want license
*/
(function(window, $){
var $plugin = $.sub();
$plugin.fn.animate = function(props, speed, cb){
@darcyclarke
darcyclarke / youtubeThumb.php
Created May 27, 2016
Get the video thumbnail for a YouTube video from a URL
View youtubeThumb.php
<?php
/***********************************************/
/* Get a Youtube or Vimeo video's Thumbnail from a URL
/* http://darcyclarke.me/articles/development/get-image-for-youtube-or-vimeo-videos-from-url/
/*
/* Copyright 2016, Darcy Clarke
/* Do what you want license
/***********************************************/
function video_image($url){
$image_url = parse_url($url);
@darcyclarke
darcyclarke / pubsub.js
Last active Sep 17, 2016
Library agnostic publish/subscribe
View pubsub.js
/*!
*
* Library Agnostic Pubsub
* http://darcyclarke.me/articles/development/library-agnostic-pubsub-publish-subscribe/
*
* Copyright 2016, Darcy Clarke
* Do what you want license...
*
*/
(function(window){