Skip to content

Instantly share code, notes, and snippets.

View Sphinxxxx's full-sized avatar

Andreas Borgen Sphinxxxx

View GitHub Profile
@noygal
noygal / Windows Subsystem for Linux version 1 and 2 (WSL) - node install guide.md
Last active February 21, 2024 23:17
Installing node via windows subsystem for linux

Windows 10 version 2004 - Installing Node.js on Windows Subsystem for Linux (WSL/WSL2)

UPDATE (Fall 2020): This gist is an updated version to the Windows 10 Fall Creators Update - Installing Node.js on Windows Subsystem for Linux (WSL) guide, I usually just keep here notes, configuration or short guides for personal use, it was nice to know it also helps other ppl, I hope this one too.

Windows updated windows subsystem for linux to version 2, as the F.A.Q stated you can still use WSL version 1 side by side with version 2. I'm not sure about existing WSL machines surviving the upgrade process, but as always backup and 🤞. NOTE: WSL version 1 is not replace/deprecated, and there ar

@mjs
mjs / fib.rs
Created August 25, 2017 01:54
Fibonacci sequence generation done in 3 ways using Rust
const ITERS: usize = 20;
fn print_fib(n: usize) {
let mut x = (1, 1);
for i in 0..n {
println!("{}: {}", i, x.0);
x = (x.1, x.0 + x.1)
}
}
@chrisguttandin
chrisguttandin / post.md
Created May 31, 2017 16:27
What else can we do with the Web Audio API?

What else can we do with the Web Audio API?

Of course the Web Audio API is meant for synthesizing and processing audio data. It is tailored for that use case. But at least in our digital world audio data is just a series of numbers, which are typically somewhere between +1 and -1. So why can't we use the Web Audio API for general computations?

Almost a year ago I had the pleasure to give a talk at the Web Audio Conference in Atlanta. The conference featured a lot of great talks, which I really appreciated as an attendee. However, as a speaker it was tough to reduce my own talk until it was short enough to fit into the schedule. I had the feeling that I had to rush through my slides. Since then I planned to write down my findings in a more detailed way, but I never got around to it. Luckily I was asked to repeat my talk at our local Web Audio Meetup here in

@clhenrick
clhenrick / .block
Last active June 14, 2023 09:45
Custom tiles in Google Maps
license: apache-2.0
@swissspidy
swissspidy / language-updates-table.php
Last active April 4, 2020 11:20
Display a table with available translation updates on the WordPress update screen
<?php
/**
* Plugin Name: Translation Updates Table
*
* @author Pascal Birchler <pascal@required.ch>
* @license GPL2+
*/
/**
* Displays a table with available translation updates.
@tomhodgins
tomhodgins / dragon.html
Last active October 11, 2017 05:02
Dragon.js is a bookmarklet that lets you drag any element on a website using a mouse or touchscreen. The goal is to speed up in-browser design critiques and brainstorming new layout ideas. Demo at http://staticresource.com/dragon.html
<!DOCTYPE html>
<html data-theme=dark>
<head>
<meta charset=utf-8>
<meta name=viewport content="width=device-width, initial-scale=1">
<title></title>
<link href=http://fonts.googleapis.com/css?family=Fira+Sans:300,400,500,700,300italic,400italic,500italic,700italic rel=stylesheet>
<link href=http://fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,400,600,700,900,200italic,300italic,400italic,600italic,700italic,900italic rel=stylesheet>
<link href="//fonts.googleapis.com/css?family=PT+Serif:400,700,400italic,700italic" rel=stylesheet type=text/css>
<link href=http://staticresource.com/basic.css rel=stylesheet>
@esbullington
esbullington / intro.md
Last active September 30, 2018 11:59
Convert Stylus to SASS/SCSS

Convert Stylus to SASS

Here's how I converted a whole batch of Stylus files to SASS without using a converter (none exist, that I'm aware of), converting each Stylus file manually, or programming my own Stylus->SASS converter, which would have entailed building a parser, and then generate SCSS from the AST.

First, grab sandr.py here: https://github.com/jfgiraud/sandr

Then, in the directory of your Stylus files, run (if you have multiple directory levels, you can do similar task using find):

for file in *.styl; do echo "/*! FILENAME: $file */" >tempfile; cat $file >>tempfile; mv tempfile $file; done 
@nicholaswmin
nicholaswmin / catmullFitter.js
Created September 7, 2015 12:49
Catmull Rom Fitting Algorithm in Javascript through a series of X/Y Points
/**
* Interpolates a Catmull-Rom Spline through a series of x/y points
* Converts the CR Spline to Cubic Beziers for use with SVG items
*
* If 'alpha' is 0.5 then the 'Centripetal' variant is used
* If 'alpha' is 1 then the 'Chordal' variant is used
*
*
* @param {Array} data - Array of points, each point in object literal holding x/y values
* @return {String} d - SVG string with cubic bezier curves representing the Catmull-Rom Spline
@danielgtaylor
danielgtaylor / gist:0b60c2ed1f069f118562
Last active April 2, 2024 20:18
Moving to ES6 from CoffeeScript

Moving to ES6 from CoffeeScript

I fell in love with CoffeeScript a couple of years ago. Javascript has always seemed something of an interesting curiosity to me and I was happy to see the meteoric rise of Node.js, but coming from a background of Python I really preferred a cleaner syntax.

In any fast moving community it is inevitable that things will change, and so today we see a big shift toward ES6, the new version of Javascript. It incorporates a handful of the nicer features from CoffeeScript and is usable today through tools like Babel. Here are some of my thoughts and issues on moving away from CoffeeScript in favor of ES6.

While reading I suggest keeping open a tab to Babel's learning ES6 page. The examples there are great.

Punctuation

Holy punctuation, Batman! Say goodbye to your whitespace and hello to parenthesis, curly braces, and semicolons again. Even with the advanced ES6 syntax you'll find yourself writing a lot more punctuatio