Skip to content

Instantly share code, notes, and snippets.

View blech75's full-sized avatar
🤖

justin blecher blech75

🤖
  • BDL
  • 05:47 (UTC -04:00)
View GitHub Profile
@blech75
blech75 / extensions.md
Last active June 16, 2021 13:43
my top vscode extensions

my top vscode extensions

essential extensions

  • johnpapa.vscode-peacock
  • kruemelkatze.vscode-dashboard
  • artdiniz.quitcontrol-vscode
  • bmalehorn.test-switcher
  • streetsidesoftware.code-spell-checker
  • sysoev.vscode-open-in-github
@blech75
blech75 / gaedev.bash
Created August 17, 2020 15:18
gaedev: pass env vars from .env to dev_appserver.py
function gaedev() {
env_vars_args=""
if [ -f '.env' ]; then
echo "> Using .env file:"
# indent the env to look nicer
perl -pe's/^/ /' <.env
echo
env_vars_args=$(perl -pe's/^(export )?/--env_var /' <.env | perl -pe's/\n/ /')
else
import { ApolloClient } from 'apollo-client';
import { ApolloLink } from 'apollo-link';
import ApolloLinkTimeout from 'apollo-link-timeout';
import { HttpLink } from 'apollo-link-http';
import { setContext } from 'apollo-link-context';
import { createPersistedQueryLink } from 'apollo-link-persisted-queries';
import { onError } from 'apollo-link-error';
import {
InMemoryCache,
IntrospectionFragmentMatcher
@blech75
blech75 / withAmpSass.js
Created August 16, 2018 14:42
next.js webpack config for outputting AMP-specific Sass to separate file
// Copied from @zeit/next-sass and modified to so that we can define AMP styles
// in *.amp.scss and normal styles in *.scss (excludes *.amp.scss). Normal
// styles are output as before; AMP styles are output to styles-amp.scss
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const cssLoaderConfig = require('@zeit/next-css/css-loader-config');
const commonsChunkConfig = require('@zeit/next-css/commons-chunk-config');
module.exports = (nextConfig = {}) =>
Object.assign({}, nextConfig, {
@blech75
blech75 / .htaccess
Created February 8, 2018 04:05
apache config for canonical redirect via mod_rewrite
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# with www prefix, ignoring protocol
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
# without www prefix, HTTP only
RewriteCond %{HTTPS} off
@blech75
blech75 / readme.md
Created October 5, 2017 19:55
How to fix the "NFS requires a host-only network to be created." message during 'vagrant up'

The following happened to me with Vagrant 2.0 and VirtualBox 5.1.28, though I expect that it affects earlier versions of Vagrant, too.

When using DHCP with NFS, your initial vagrant up might like this:

[...]
==> default: Checking for guest additions in VM...
    default: The guest additions on this VM do not match the installed version of
    default: VirtualBox! In most cases this is fine, but in rare cases it can
    default: prevent things such as shared folders from working properly. If you see
    default: shared folder errors, please make sure the guest additions within the
@blech75
blech75 / npm-deps-changes.sh
Created October 4, 2017 15:52
diff `npm ls --depth=0` output versions between releases
#!/bin/bash
if [ "$#" -ne "1" ]; then
echo "Usage: `basename $0` RELEASES_DIR"
exit 1
fi
diff_releases() {
echo "Diffing $# releases..."
@blech75
blech75 / Show Tab and Window Names.scpt
Created March 29, 2016 16:11
AppleScript to Show Safari Tab and Window Names
tell application "Safari"
set windowCount to number of windows
set docText to ""
repeat with w from 1 to windowCount
set currentWin to window w
if (name of currentWin is "") or (name of currentWin is "Extensions") then
-- do nothing
else
@blech75
blech75 / gist:2c3dbebb6bb782345273
Last active November 4, 2015 00:59
modernizr test files and the test names within them (as of v3.1.0). useful for configuring grunt-modernizr (customizr) if not using the 'crawl' feature.
$ ag --noheading -o "Modernizr.addTest\('[a-z]+'" | sed -E 's/Modernizr\.addTest\(//' | sed -E 's/\.js\:[0-9]+/.js/' | grep -vE '^$' | uniq | sort | column -t -s ':'
a/download.js 'adownload'
ambientlight.js 'ambientlight'
applicationcache.js 'applicationcache'
audio.js 'audio'
audio/loop.js 'audioloop'
audio/preload.js 'audiopreload'
audio/webaudio.js 'webaudio'
battery.js 'batteryapi'
battery/lowbattery.js 'lowbattery'