Skip to content

Instantly share code, notes, and snippets.

@dasilvaluis
dasilvaluis / gulpfile.js
Last active September 27, 2021 09:34
Gettext Scanner Gulp Script for Twig Projects
View gulpfile.js
/**
* Gettext Scanner Script for Twig Projects
* v1.3
*
* Developed by Luís Silva
* https://github.com/luism-s
*/
/**
* Purpose:
@zenspider
zenspider / unit.rb
Created November 12, 2015 00:25
the original minitest impl
View unit.rb
#
# Totally minimal (hopefully) drop-in replacement for test/unit
#
# TODO: document minimal core methods needed for this to work
at_exit { Test::Unit.autotest }
module Test
class Assertion < Exception; end
@Restuta
Restuta / framework-sizes.md
Last active February 27, 2023 08:54
Sizes of JS frameworks, just minified + minified and gzipped, (React, Angular 2, Vue, Ember)
View framework-sizes.md

Below is the list of modern JS frameworks and almost frameworks – React, Vue, Angular, Ember and others.

All files were downloaded from https://cdnjs.com and named accordingly. Output from ls command is stripped out (irrelevant stuff)

As-is (minified)

$ ls -lhS
566K Jan 4 22:03 angular2.min.js
@dmurawsky
dmurawsky / index.js
Last active March 16, 2023 01:16
How to make a page full height in Next.js
View index.js
const FullHeightPage = () => (
<div>
Hello World!
<style global jsx>{`
html,
body,
body > div:first-child,
div#__next,
div#__next > div {
height: 100%;
@vitorbritto
vitorbritto / rm_mysql.md
Last active March 20, 2023 08:15
Remove MySQL completely from Mac OSX
View rm_mysql.md

Remove MySQL completely

  1. Open the Terminal

  2. Use mysqldump to backup your databases

  3. Check for MySQL processes with: ps -ax | grep mysql

  4. Stop and kill any MySQL processes

  5. Analyze MySQL on HomeBrew:

    brew remove mysql
    
@steinwaywhw
steinwaywhw / One Liner to Download the Latest Release from Github Repo.md
Last active March 22, 2023 08:18
One Liner to Download the Latest Release from Github Repo
View One Liner to Download the Latest Release from Github Repo.md
  • Use curl to get the JSON response for the latest release
  • Use grep to find the line containing file URL
  • Use cut and tr to extract the URL
  • Use wget to download it
curl -s https://api.github.com/repos/jgm/pandoc/releases/latest \
| grep "browser_download_url.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \
@joeytwiddle
joeytwiddle / async-await-forEach-alternatives.md
Last active March 22, 2023 11:05
Do not use forEach with async-await
View async-await-forEach-alternatives.md

Do not use forEach with async-await

TLDR: Use for...of instead of forEach in asynchronous code.

The problem

Array.prototype.forEach is not designed for asynchronous code. (It was not suitable for promises, and it is not suitable for async-await.)

For example, the following forEach loop might not do what it appears to do: