Skip to content

Instantly share code, notes, and snippets.

go.ugotsta.com Ugotsta

Block or report user

Report or block Ugotsta

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@freedmand
freedmand / tester.js
Last active Nov 7, 2018
JavaScript unit testing in under 30 lines
View tester.js
const PASS = ['32']; // green
const FAIL = ['31', '1']; // red, bold
function logStyle(ansiEscapeCodes, text) {
console.log(`\x1b[${ansiEscapeCodes.join(';')}m${text}\x1b[0m`);
}
class Tester {
constructor() {}
@shaggyrogers
shaggyrogers / neovim_startify_header.vim
Last active Jun 24, 2019
ascii art 'neovim' startify header
View neovim_startify_header.vim
let s:startify_ascii_header = [
\ ' ▟▙ ',
\ ' ▝▘ ',
\ '██▃▅▇█▆▖ ▗▟████▙▖ ▄████▄ ██▄ ▄██ ██ ▗▟█▆▄▄▆█▙▖',
\ '██▛▔ ▝██ ██▄▄▄▄██ ██▛▔▔▜██ ▝██ ██▘ ██ ██▛▜██▛▜██',
\ '██ ██ ██▀▀▀▀▀▘ ██▖ ▗██ ▜█▙▟█▛ ██ ██ ██ ██',
\ '██ ██ ▜█▙▄▄▄▟▊ ▀██▙▟██▀ ▝████▘ ██ ██ ██ ██',
\ '▀▀ ▀▀ ▝▀▀▀▀▀ ▀▀▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀',
\ '',
\]
@roninhack
roninhack / reverse-proxy.md
Created Oct 5, 2017 — forked from greim/reverse-proxy.md
Using a Reverse Proxy for Rapid Prototyping
View reverse-proxy.md

Using a Reverse Proxy for Rapid Prototyping

Note: This will be a contrived example, but hopefully illustrates some real-world trade-offs.

Example scenario: Suppose you're an independent web developer, and a client asks you to prototype a redesign of their website header. You'll be paid for your time, and if the client likes it, you'll be hired to do the full implementation. Your incentive is to show the client a quick, functional demo of the updated header. The problem is that quick and functional tend to be mutually-exclusive.

At One Extreme: Do It Fast

View string-reverse.js
// One liner.
const reverseIt = (string, memo='') => string.length ? reverseIt(string.substr(1), string.substr(0,1) + memo) : memo
// same as:
function reverseIt2 (string, memo='') {
if (string.length) {
return reverseIt2(string.substr(1), string.substr(0,1) + memo);
} else {
return memo;
@kovrov
kovrov / blender-keys.md
Last active Aug 26, 2017
Blender keys
View blender-keys.md

blender hotkeys

Basics

Right click Select

Middle click Pan

Mouse wheel Zoom

@msmfsd
msmfsd / es7-async-await.js
Last active Aug 17, 2019
Javascript fetch JSON with ES7 Async Await
View es7-async-await.js
// Async/Await requirements: Latest Chrome/FF browser or Babel: https://babeljs.io/docs/plugins/transform-async-to-generator/
// Fetch requirements: Latest Chrome/FF browser or Github fetch polyfill: https://github.com/github/fetch
// async function
async function fetchAsync () {
// await response of fetch call
let response = await fetch('https://api.github.com');
// only proceed once promise is resolved
let data = await response.json();
// only proceed once second promise is resolved
@lava
lava / nethack_armor.md
Last active Jun 10, 2018
Nethack armor comparison
View nethack_armor.md

Nethack armor comparison

Imagine this totally hypothetical situation: You're in a boring meeting without internet, play a round of nethack as a rogue, and come across a dwarvish mithril-coat. Should you replace your current leather armor? On the one hand, mithril sounds pretty nifty. On the other hand, it seems a bit out-of-character for a rogue to wear full plate armor, so surely there are some good reasons to keep the leather?

Luckily, you are a professional developer, so you have a local copy of the games' source code.

@deekayen
deekayen / Drop.txt
Last active Oct 27, 2017
Backdrop Drop mascot ASCII art for /etc/motd in 80x25 terminal windows. Converted using jp2a --background=light -f. The extra space on the top of the lounging version makes sure Drop gets to set on the bottom of the terminal when it opens.
View Drop.txt
.'
dd
0WWWNx,...
.:X0WWWWXO:lXx..
.. dNWWd; kWWxc.
,XWWKOXWWW0:.
.XWWWWWWWWd;
.XWWWWWWook0x:.
.oNWWWWWWc .;.
.dKXWWWWWWl .;o0x;'.
@UsabilityEtc
UsabilityEtc / javascript-array-of-random-values.js
Created Jun 12, 2016
Create and fill a JavaScript array with random values.
View javascript-array-of-random-values.js
function randomDataSet(dataSetSize, minValue, maxValue) {
return new Array(dataSetSize).fill(0).map(function(n) {
return Math.random() * (maxValue - minValue) + minValue;
});
}
View Switching between Rust stable and Rust nightly
# Use multirust to manage multiple Rust builds:
# 1. Install multirust
curl -sf https://raw.githubusercontent.com/brson/multirust/master/blastoff.sh | sh
# 2. Show installed Rust builds
multirust list-toolchains
# 3. Install new build (stable, beta, nightly)
multirust update nightly
You can’t perform that action at this time.