Skip to content

Instantly share code, notes, and snippets.

View mavame's full-sized avatar

Matt Van Meter mavame

View GitHub Profile
@adamwathan
adamwathan / promise-take-at-least.js
Last active February 26, 2023 14:25
Promise.takeAtLeast
// Creates a new promise that automatically resolves after some timeout:
Promise.delay = function (time) {
return new Promise((resolve, reject) => {
setTimeout(resolve, time)
})
}
// Throttle this promise to resolve no faster than the specified time:
Promise.prototype.takeAtLeast = function (time) {
return new Promise((resolve, reject) => {
@indiesquidge
indiesquidge / promise-dot-all.js
Last active January 20, 2024 15:03
Recreating Promise.all with async/await
/*
Let us re-create `Promise.all`
`Promise.all` method returns a promise that resolves when all of the promises in the iterable argument have resolved,
or rejects with the reason of the first passed promise that rejects.
Read more about `Promise.all` on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all
A basic example would be something like this:
@rveitch
rveitch / sass-7-1-pattern.scss
Last active April 12, 2024 13:52
Sass 7-1 Pattern
sass/
|
|– base/
| |– _reset.scss # Reset/normalize
| |– _typography.scss # Typography rules
| ... # Etc…
|
|– components/
| |– _buttons.scss # Buttons
| |– _carousel.scss # Carousel
(function($) {
function parseImagesFromCSS(doc) {
var i, j,
rule,
image,
pattern = /url\((.*)\)/,
properties = ['background-image', '-webkit-border-image'],
images = {};
if (doc.styleSheets) {
@listochkin
listochkin / node-command-line-options.txt
Created April 17, 2014 11:00
Node V8 GC-related options
--log_gc (Log heap samples on garbage collection for the hp2ps tool.)
type: bool default: false
--expose_gc (expose gc extension)
type: bool default: false
--max_new_space_size (max size of the new generation (in kBytes))
type: int default: 0
--max_old_space_size (max size of the old generation (in Mbytes))
type: int default: 0
--max_executable_size (max size of executable memory (in Mbytes))
type: int default: 0
@magnetikonline
magnetikonline / README.md
Last active March 14, 2024 22:48
IE 7/8/9/10/11 Virtual machines from Microsoft - Linux w/VirtualBox installation notes.
@maxcnunes
maxcnunes / Debug-Knockout-JS.html
Last active April 26, 2019 11:07
Simple way to debug viewmodel data bind with knockout
<pre data-bind="text: ko.toJSON($data, null, 2)"></pre>
@jimmyalcala
jimmyalcala / .bash_prompt
Created December 1, 2012 23:19
.bash Style Jeffrey way
# Sexy Bash Prompt, inspired by "Extravagant Zsh Prompt"
# Screenshot: http://img.gf3.ca/d54942f474256ec26a49893681c49b5a.png
# A big thanks to \amethyst on Freenode
if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then export TERM=gnome-256color
elif [[ $TERM != dumb ]] && infocmp xterm-256color >/dev/null 2>&1; then export TERM=xterm-256color
fi
if tput setaf 1 &> /dev/null; then
tput sgr0
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active April 18, 2024 10:01
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@pascalduez
pascalduez / demo.module
Created December 24, 2011 15:02
Drupal 7 — Basic Ajax form submit (Ajax framework)
<?php
/**
* @file
* Demo module, Basic Ajax form submit (Ajax framework).
*/
/**
* Implements hook_menu().
*/