Skip to content

Instantly share code, notes, and snippets.

@esedic
esedic / detect_touch.js
Created September 6, 2019 11:34
Various JavaScript methods for detecting touch/mobile devices
// Method 1
var isTouchDevice =
(('ontouchstart' in window) ||
(navigator.MaxTouchPoints > 0) ||
(navigator.msMaxTouchPoints > 0));
if(!isTouchDevice){
console.log('is not touch');
}else{
console.log('is touch');
}
@egalink
egalink / extend.js
Last active November 29, 2023 14:56
A vanilla js function to merge the contents of two or more JavaScript objects together into a new object like jQuery.extend() method.
/**
* A native JS extend() function
*
* Returns a new object instead, preserving all of the original objects
* and their properties. Supported back to IE6.
*
* Usage:
* 1.- Pass in the objects to merge as arguments.
* 2.- For a deep extend, set the first argument to `true`.
*
@kn
kn / README.md
Last active October 26, 2018 21:10
How to test Apple Pay integration with stripe.js?
  1. Follow Stripe's instructions to setup the Apple Pay Sandbox. Note that you need to pay $99 to enroll into Apple's Developer Program. Also, you need to use a real iOS device, not a simulator that comes with Xcode.
  2. Apple Pay only works over HTTPS so you need to use a tool like (stunnel)[https://www.stunnel.org/index.html] to serve your website over https locally.
@pawiromitchel
pawiromitchel / urlExists.js
Created January 27, 2017 11:27
JS - check if an object or url exists
function urlExists(testUrl) {
var http = $.ajax({
type:"HEAD",
url: testUrl,
async: false
})
return http.status;
// this will return 200 on success, and 0 or negative value on error
}
@MFry
MFry / Webpack and toastr
Last active February 16, 2023 16:58
Getting toastr npm to play with webpack
//In case anyone was having the same issue in getting toastr to run with webpack and es6
@juno
juno / atom-setup.md
Last active March 12, 2023 21:07
My Atom editor setup.

My Atom editor setup

Atom

Atom Shell Commands

  • Launch Atom and select "Atom - Install Shell Commands" menu to install atom and apm commands
  • Add /usr/local/bin to PATH environment varibale
@saulhardman
saulhardman / main.js
Created October 14, 2015 14:35
Using Modernizr v3 with Webpack (and ES6)
import Modernizr from 'imports?window=>{}!exports?window.Modernizr!vendor/modernizr';
@mlanett
mlanett / rails http status codes
Last active October 22, 2025 18:39
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Example</title>
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/jquery.slick/1.3.6/slick.css"/>
<style>
.menu {
text-align: center;
}
@joelremix
joelremix / momentum-scrolling-ios.css
Created April 29, 2014 03:22
CSS: momentum scroll ios
.module {
overflow-y: scroll; /* has to be scroll, not auto */
-webkit-overflow-scrolling: touch;
}