var startDate = Date.now();
window.startTime = starDate.getTime();

/* do stuff */

var endDate = Date.now();
duration = endDate.getTime() - window.startTime

console.log("Elapsed Milliseconds", duration);

Calculating Elapsed Milliseconds in JS Simple JavaScript for calculating elapsed time in milliseconds.… posted by jinx 17.02.24 @314 JAVASCRIPT

More

document.addEventListener('DOMContentLoaded', function(event) {
	document.getElementById('modalOpenButton').addEventListener('click', function(event) {
		/ set start time for timing modal open
		window.modalStart = Date.now();
		/ send open event to analytics
		ga('send', 'event', {
			'eventCategory': 'My Modal',
			'even…

Track Modal with Google Analytics This is just a quick example of how you can use Google Analytics to track a modal opening, closing and the duration in betwee… posted by jinx 17.02.17 @334 JAVASCRIPT

(206) 834-9610

class MyObject:
    propA = "Some Value"
    propB = "Other Value"

myObject = MyObject()

if hasattr(myObject, 'propA'):
    myObject.property

If object has an attribute  posted by mjetpax 17.02.02 @402 PYTHON

8308725975

if 7 <= yourInt <= 42:
    pass

Number between two numbers If your_int is greater than or equal to 7 and less than or equal to 42, do something awesome! posted by mjetpax 17.02.02 @397 PYTHON

nostalgy

var total = parseFloat(total) * 1.25;
total = total < 300 ? 300 : total;

Simple math in JS - untested  posted by mjetpax 17.01.31 @248 JAVASCRIPT

More

str = "I love list comprehensions 123"
nums = [n for n in string if n.isdigit()]
print nums

# >> ['1', '2', '3']

List Comprehension Example A quick list comprehension example. It gets all numbers out of a string. posted by Jinx 16.12.17 @384 PYTHON

More

{
    / Set end of line characters to Unix style. 
    / Use "/r/n" for Windows style.
    "files.eol": "\n",
}

VS Code End of Line Setting Changes VS Code's end of line setting to Unix style line endings. posted by Jinx 16.12.16 @258 JSON

7788709880

-- define source and target tables
MERGE database2.new_table AS TARGET
USING database2.original_table AS SOURCE 
ON (TARGET.id = SOURCE.id) 
--when a record matchs, update the target
WHEN MATCHED AND TARGET.name <> SOURCE.name 
OR TARGET.description <> SOURCE.description THEN 
UPDATE SET TARGET.name = SOURCE.name…

Sync two SQL Tables using merge This is a handy little script example for synchronizing two SQL tables.… posted by mjetpax 16.03.08 @174 SQL

More

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>YouTube Embedd</title>
    <style TYPE="text/css">
      .video-wrapper {
        position:relative;
      	padding-bottom:56.25%;
      	padding-top:30px;
      	height:0;
      	overflow:h…

YouTube Iframe Fluid Embed within Viewport YouTube iframe fluid embed within viewport with small height reduction to incorporate bottom info bar.… posted by mjetpax 16.01.21 @125 HTML

More

$this->unlisted = true;

Unlisted? 15.12.12 @671 PHP

More