Skip to content

Instantly share code, notes, and snippets.

View apolkingg8's full-sized avatar
🍊
ORANGGGGGEEEEE!!!

Eddie Hsu apolkingg8

🍊
ORANGGGGGEEEEE!!!
View GitHub Profile
@gaearon
gaearon / promise_scheduler.js
Last active March 29, 2018 06:12
Q promise concurrency limiter
'use strict';
var q = require('q');
/**
* Constructs a function that proxies to promiseFactory
* limiting the count of promises that can run simultaneously.
* @param promiseFactory function that returns promises.
* @param limit how many promises are allowed to be running at the same time.
* @returns function that returns a promise that eventually proxies to promiseFactory.
@lsauer
lsauer / gist:5196979
Last active June 7, 2023 08:12
JavaScript List of selected MIME types (JSON)
//lsauer.com , lo sauer 2013
//JavaScript List of selected MIME types
//A comprehensive MIME List is available here: https://gist.github.com/lsauer/2838503
var mimeTypes =
{
'a' : 'application/octet-stream',
'ai' : 'application/postscript',
'aif' : 'audio/x-aiff',
'aifc' : 'audio/x-aiff',
'aiff' : 'audio/x-aiff',
@fnicollier
fnicollier / insertAtCaret.js
Created December 11, 2012 13:12
Insert text into a textarea at cursor position
//http://www.scottklarr.com/topic/425/how-to-insert-text-into-a-textarea-where-the-cursor-is/
function insertAtCaret(areaId,text) {
var txtarea = document.getElementById(areaId);
var scrollPos = txtarea.scrollTop;
var strPos = 0;
var br = ((txtarea.selectionStart || txtarea.selectionStart == '0') ?
"ff" : (document.selection ? "ie" : false ) );
if (br == "ie") {
txtarea.focus();
var range = document.selection.createRange();