Skip to content

Instantly share code, notes, and snippets.

View duncanmcclean's full-sized avatar

Duncan McClean duncanmcclean

View GitHub Profile
@maxboeck
maxboeck / donottrack.js
Last active November 6, 2023 10:00
Check "Do Not Track" Client Hint
const allowsTracking = () => {
const dnt =
window.doNotTrack ||
navigator.doNotTrack ||
navigator.msDoNotTrack
if (dnt === 1 || dnt === '1' || dnt === 'yes') {
return false
}
if ('msTrackingProtectionEnabled' in window.external) {
return !window.external.msTrackingProtectionEnabled()
@calebporzio
calebporzio / webpack.mix.js
Created March 2, 2019 15:17
A webpack.mix.js file for writing NPM packages the way you write JS in a Laravel app.
let mix = require('laravel-mix');
mix.js('src/index.js', 'dist/foo.js').sourceMaps();
mix.webpackConfig({
output: {
libraryTarget: 'umd',
}
})
@gmolveau
gmolveau / fathom_to_heroku.md
Last active July 11, 2020 18:06
How to push Fathom analytics - https://github.com/usefathom/fathom to Heroku

Deploy Fathom on Heroku

Requirements

  • heroku cli (logged in)
  • git
  • curl
  • wget
  • tar are required
  • ~ openssl is required to generate the secret_key, but you're free to use what you want
@HoldOffHunger
HoldOffHunger / bradvin.social.share.urls.txt
Last active April 18, 2024 13:41
Social Share URL's (Summary)
https://www.facebook.com/sharer.php?u={url}
https://www.facebook.com/dialog/share?app_id={app_id}&display={page_type}&href={url}&redirect_uri={redirect_url}
https://reddit.com/submit?url={url}&title={title}
https://twitter.com/intent/tweet?url={url}&text={title}&via={user_id}&hashtags={hash_tags}
https://www.linkedin.com/sharing/share-offsite/?url={url}
https://api.whatsapp.com/send?phone={phone_number}&text={title}%20{url}
https://www.tumblr.com/widgets/share/tool?canonicalUrl={url}&title={title}&caption={text}&tags={hash_tags}
http://pinterest.com/pin/create/button/?url={url}
https://www.blogger.com/blog-this.g?u={url}&n={title}&t={text}
https://www.evernote.com/clip.action?url={url}&title={title}
@dunglas
dunglas / example.php
Created April 19, 2018 06:25
A minimalist GraphQL client for PHP
<?php
$query = <<<'GRAPHQL'
query GetUser($user: String!) {
user (login: $user) {
name
email
repositoriesContributedTo {
totalCount
}
@judy2k
judy2k / parse_dotenv.bash
Created March 22, 2017 13:34
Parse a .env (dotenv) file directly using BASH
# Pass the env-vars to MYCOMMAND
eval $(egrep -v '^#' .env | xargs) MYCOMMAND
# … or ...
# Export the vars in .env into your shell:
export $(egrep -v '^#' .env | xargs)
@i-like-robots
i-like-robots / functions.php
Created August 21, 2012 10:01
Wordpress custom comment form
<?php
/**
* Comment form hidden fields
*/
function comment_form_hidden_fields()
{
comment_id_fields();
if ( current_user_can( 'unfiltered_html' ) )
{