Skip to content

Instantly share code, notes, and snippets.

@dgeibi
dgeibi / async.js
Created November 26, 2017 08:26
async promise timer
async function async1() {
console.log('async 1')
await async2()
await async3()
console.log('async 1-1')
}
async function async2() {
console.log('async 2')
}
@johan
johan / jquery.nodoubletapzoom.js
Created March 15, 2012 22:59
A jQuery plugin to selectively disable the iOS double-tap-to-zoom action on specific page elements (and have that generate two click events instead).
// jQuery no-double-tap-zoom plugin
// Triple-licensed: Public Domain, MIT and WTFPL license - share and enjoy!
(function($) {
var IS_IOS = /iphone|ipad/i.test(navigator.userAgent);
$.fn.nodoubletapzoom = function() {
if (IS_IOS)
$(this).bind('touchstart', function preventZoom(e) {
var t2 = e.timeStamp
content+='<a href= '#' class='pdf_viewer' data-url='+val2.displayUrl+ '>' + val2.displayUrl +'</a>'
Include this line in JS
$('a.pdf_viewer').live('click', function(e){
e.preventDefault();
url = $(e.target).data('url');
window.location = url;
});
@pantor
pantor / nvidia-driver-realtime.sh
Last active May 1, 2024 21:06
Installing NVIDIA drivers on a realtime Linux (PREEMPT-RT)
# Tested on Ubuntu 16.04 and X11, 2019
# 1. Download NVIDIA driver as a .run file
# 2. Stop X-Server
sudo service lightdm stop
# 3. Blacklist Nouveau driver
sudo nano /etc/modprobe.d/blacklist-nouveau.conf
@aamiaa
aamiaa / CompleteDiscordQuest.md
Last active May 1, 2024 21:05
Complete Recent Discord Quest

Complete Recent Discord Quest

Note

This no longer works in browser!

Note

This no longer works if you're alone in vc! Somebody else has to join you!

How to use this script:

  1. Accept the quest under User Settings -> Gift Inventory
@dgp
dgp / youtube api video category id list
Created June 11, 2015 05:57
youtube api video category id list
2 - Autos & Vehicles
1 - Film & Animation
10 - Music
15 - Pets & Animals
17 - Sports
18 - Short Movies
19 - Travel & Events
20 - Gaming
21 - Videoblogging
22 - People & Blogs
@bradtraversy
bradtraversy / eslint_prettier_airbnb.md
Created July 19, 2019 17:54
ESLint, Prettier & Airbnb Setup

VSCode - ESLint, Prettier & Airbnb Setup

1. Install ESLint & Prettier extensions for VSCode

Optional - Set format on save and any global prettier options

2. Install Packages

npm i -D eslint prettier eslint-plugin-prettier eslint-config-prettier eslint-plugin-node eslint-config-node
/*
DO NOT USE THIS POLYFILL
because `instanceof` operator won't work
copy from
https://github.com/paulmillr/es6-shim
https://github.com/wesleytodd/setprototypeof
https://github.com/zloirock/core-js
*/
Object.setPrototypeOf =
class Class {
w(config) {
config = arguments[1]; config.url = arguments[0]; console.log(arguments[1],arguments[0]);
}
}
new Class().w('xxx', {})
function fn(config) { config = arguments[1]; config.url = arguments[0]; console.log(arguments[1],arguments[0]); }
fn('xxx', {})