Skip to content

Instantly share code, notes, and snippets.

Avatar

Daniel Schildt d2s

View GitHub Profile
View npm-config-set-prefix.md

bad practice

sudo npm i -g <module>

good practice

npm config set prefix <directory>
@simonw
simonw / readme.md
Created Mar 26, 2020
Making a Datasette of Finnish coronavirus data
View readme.md
View 01_typescript_intro.md

TypeScript intro

How to setup TypeScript and use in a normal JavaScript project for learning purposes.

Preparations

  • mkdir lab-ts
  • cd lab-ts
  • git init
  • touch .gitignore. Add node_modules and build to the file.
@NeilJS
NeilJS / gist:32ac664f846bdea9aac25a428fe3727a
Created Sep 30, 2019
Chrome snippet: designMode="on" + kill all links
View gist:32ac664f846bdea9aac25a428fe3727a
// Disable anchor links
window.addEventListener("click", function (event) {
event.preventDefault();
});
// Disable click eventlisteners
window.addEventListener("click", function (event) {
event.stopPropagation();
}, true);
// design mode on
document.designMode = "on";
View SpinningTorus3D.js
const Torus3D = {
props: {
// 3D -> 2D projection settings
camera: {
type: 'orthographic',
zoom: 2.25,
position: [ 1, 1, 1 ]
},
// Vertex transformation before screen space transformation
transform: {
@d2s
d2s / pull-changes-from-upstream.sh
Created Jun 20, 2019
Pull changes from an upstream Git repository
View pull-changes-from-upstream.sh
#!/usr/bin/env bash
# Add `upstream` Git repository
# git remote add upstream https://github.com/d2s/companies.git
# Merge latest changes from the `upstream` Git repository
git fetch upstream
git checkout master
git merge upstream/master
View .bash_profile
listening() {
if [ $# -eq 0 ]; then
sudo lsof -iTCP -sTCP:LISTEN -n -P
elif [ $# -eq 1 ]; then
sudo lsof -iTCP -sTCP:LISTEN -n -P | grep -i --color $1
else
echo "Usage: listening [pattern]"
fi
}
@illvart
illvart / meta-seo.njk
Last active Mar 10, 2020
My Eleventy project meta-seo.njk
View meta-seo.njk
{% if permalink == "/" %}
{% set canonicalUrl = metadata.canonicalUrl %}
{% else %}
{% set canonicalUrl = metadata.canonicalUrl + page.url %}
{% endif %}
<link rel="canonical" href="{{ canonicalUrl }}">
{# Social meta #}
{% if section == "articles" %}
<meta property="og:type" content="blog">
{% else %}
@sw-yx
sw-yx / 1.md
Last active Oct 20, 2020
Learn In Public - 7 opinions for your tech career
View 1.md

2019 update: this essay has been updated on my personal site, together with a followup on how to get started

2020 update: I'm now writing a book with updated versions of all these essays and 35 other chapters!!!!

1. Learn in public

If there's a golden rule, it's this one, so I put it first. All the other rules are more or less elaborations of this rule #1.

You already know that you will never be done learning. But most people "learn in private", and lurk. They consume content without creating any themselves. Again, that's fine, but we're here to talk about being in the top quintile. What you do here is to have a habit of creating learning exhaust. Write blogs and tutorials and cheatsheets. Speak at meetups and conferences. Ask and answer things on Stackoverflow or Reddit. (Avoid the walled gardens like Slack and Discourse, they're not public). Make Youtube videos

You can’t perform that action at this time.