Skip to content

Instantly share code, notes, and snippets.

Matt Van Meter mavame

Block or report user

Report or block mavame

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
View promise-take-at-least.js
// 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 Jul 24, 2019
Recreating Promise.all with async/await
View promise-dot-all.js
/*
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:
View sass-7-1-pattern.scss
sass/
|
|– base/
| |– _reset.scss # Reset/normalize
| |– _typography.scss # Typography rules
| ... # Etc…
|
|– components/
| |– _buttons.scss # Buttons
| |– _carousel.scss # Carousel
View jquery.css3caching.js
(function($) {
function parseImagesFromCSS(doc) {
var i, j,
rule,
image,
pattern = /url\((.*)\)/,
properties = ['background-image', '-webkit-border-image'],
images = {};
if (doc.styleSheets) {
View node-command-line-options.txt
--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 Oct 1, 2019
IE 7/8/9/10/11 Virtual machines from Microsoft - Linux w/VirtualBox installation notes.
View README.md
@maxcnunes
maxcnunes / Debug-Knockout-JS.html
Last active Apr 26, 2019
Simple way to debug viewmodel data bind with knockout
View Debug-Knockout-JS.html
<pre data-bind="text: ko.toJSON($data, null, 2)"></pre>
@jimmyalcala
jimmyalcala / .bash_prompt
Created Dec 1, 2012
.bash Style Jeffrey way
View .bash_prompt
# 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
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@pascalduez
pascalduez / demo.module
Created Dec 24, 2011
Drupal 7 — Basic Ajax form submit (Ajax framework)
View demo.module
<?php
/**
* @file
* Demo module, Basic Ajax form submit (Ajax framework).
*/
/**
* Implements hook_menu().
*/
You can’t perform that action at this time.