Skip to content

Instantly share code, notes, and snippets.

View tcrowe's full-sized avatar
💭
Account archived | See link

Tony Crowe tcrowe

💭
Account archived | See link
View GitHub Profile
@tcrowe
tcrowe / npm-auth-token.js
Last active February 2, 2020 18:55
npm auth token with zsh or bash and curl or node
// npm install superagent
const superagent = require("superagent");
// this is verdaccio's url ↓ but you could use like registry.npmjs.com if that is allowed in their TOS
const registryUrl = "http://127.0.0.1:4873";
const username = "myusername2";
const password = "mypassword2";
const frm ={
name: username,
@tcrowe
tcrowe / clickable-svg-path-note.md
Created September 24, 2019 20:39
Reminer about clickable SVG path

A pal discovered a trick with SVG paths. It was not clickable by default!

He found that you must customize it with CSS:

figured it out, for future reference you need to set 
the "pointer-events" property on a path to make it
clickable. There are various options available.

Found a handy little reference here... 
@tcrowe
tcrowe / sapper-preload-example.svelte
Created September 25, 2019 21:17
Sapper preload instead of using stores for dynamic data
<script context="module">
/*
Preload runs on the client AND server
*/
export async function preload({ path, query, params, session }) {
console.log('path', path)
console.log('query', query)
console.log('params', params)
@tcrowe
tcrowe / keymap.cson
Created October 25, 2019 19:56
atom editor, emmet, svelte language-specific tab trigger, keymap.cson
# svelte language-specific tab trigger
# NOT source.js scope -------------------------------v
'atom-text-editor[data-grammar="source svelte"]:not(.source.js)':
'tab': 'emmet:expand-abbreviation-with-tab'
@tcrowe
tcrowe / oblierate-service.zsh
Created January 29, 2020 23:53
Obliterate systemd service
#!/bin/zsh
#
# Obliterate systemd service
# https://superuser.com/questions/513159/how-to-remove-systemd-services#936976
#
systemctl stop $1 2>/dev/null || true
systemctl stop $1.service 2>/dev/null || true
systemctl disable $1 2>/dev/null || true
@tcrowe
tcrowe / optimize-and-shut-up-npm.sh
Last active December 21, 2019 22:08
optimize and shut-up npm
npm config set -g send-metrics false
npm config set -g metrics-registry "http://127.0.0.1:11923"
npm config set -g ham-it-up false
npm config set -g optional false
npm config set -g loglevel error
npm config set -g init-version "0.1.0"
npm config set -g init-license "UNLICENSED"
npm config set -g init-author-url ""
npm config set -g init-author-email ""
npm config set -g init-author-name ""
@MoOx
MoOx / less2stylus.js
Created August 27, 2012 17:37 — forked from lancejpollard/less2stylus.coffee
Convert LESS to Stylus
// Usage : less2stylusDir('../src/css/');
var fs = require('fs');
// this less 2 stylus conversion script make a stylus easy to read syntax
// - let the braces
// - replace the @ for var as $
// - let semicolons
function less2stylus(less)
@nicksheffield
nicksheffield / gulpfile.js
Last active January 7, 2017 06:04
gulp lesson example files
var gulp = require('gulp') // the main guy
var rename = require('gulp-rename') // rename files in a stream
var stylus = require('gulp-stylus') // turn stylus code into css
var plumber = require('gulp-plumber') // handle errors
var sourcemap = require('gulp-sourcemaps') // write sourcemaps
var minifycss = require('gulp-minify-css') // minify css code
var autoprefix = require('gulp-autoprefixer') // prefix any css with low support
gulp.task('css', function(){
@nicholascloud
nicholascloud / blog-npm-root-packages.md
Last active December 16, 2015 03:49
blog-npm-root-packages

The problem

When I list my npm packages with npm ls -g (or without the -g option for a local node_modules directory) I see all installed packages and their dependencies. Like so:

$ npm ls -g
├─┬ anvil.js@0.9.0-RC3.1
│ ├── colors@0.6.0
│ ├─┬ commander@1.1.1
│ │ └── keypress@0.1.0