Skip to content

Instantly share code, notes, and snippets.

Nathan Demick endemic

Block or report user

Report or block endemic

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
@endemic
endemic / color_safe.js
Created Sep 28, 2016
Coding challenge to convert a 6-digit hex color code to its nearest "web safe" equivalent
View color_safe.js
/**
* Given an input of a 6-character hex color code, we need to output a "web-safe"
* representation of that same code.
*/
'use strict';
let assert = (one, two) => {
if (one === two) {
console.info(`Success! ${one} is equal to ${two}!`);
View inclusion_xtcore_1.js
/***@licence*Copyright2014ATInternet,AllRightsReserved.*ATInternetTag4.6.4*/
window.Xtconf = {
xt1: ".laposte.fr",
xtLogDom: ".xiti.com/hit.xiti",
xtfirst: false,
xt2: "0",
xt3: 365,
xt4sec: "20",
xt4rss: "20",
xt4epr: "20",
View tc_Laposteportail_1.js
/*
* tagContainer Generator v5
* Copyright Tag Commander
* http://www.tagcommander.com/
* Generated: 2016-08-25 16:55:37 Europe/Paris
* ---
* Version : 66.02
* IDTC : 1
* IDS : 1376
*/
View overlay.js
var MetrixLab_URLwebsite = encodeURIComponent(window.location.href);
var MetrixLab_OverlayImageName;
var MetrixLab_is_Btq_Url;
//console.log('MetrixLab_URLwebsite'+MetrixLab_URLwebsite);
@endemic
endemic / coding_challenge.js
Created Aug 8, 2016
Sample coding example
View coding_challenge.js
function assert(one, two) {
if (one !== two) {
throw new Error(`${one} not equal to ${two}!!`);
} else {
console.info(`Success! ${one} is equal to ${two}!`);
}
}
function nextServerNumber(arrayOfInts) {
let lowestServerNumber = 1;
@endemic
endemic / diff.js
Created Aug 8, 2016
Image diffing using JavaScript
View diff.js
const avgDiff = (canvas) => {
let context = canvas.getContext('2d');
let imageData = context.getImageData(0, 0, canvas.width, canvas.height);
let data = imageData.data;
let sum = 0;
let count = 0;
// TODO: perhaps this can be sped up by not going over every pixel?
for (let i = 0; i < data.length; i += 4) {
View google_results_enhanced.html
<div class="g kno-result _rk mnr-c g-blk" data-hveid="25" data-ved="0ahUKEwi0jMKl6_XNAhUJaz4KHbgFCV4QjDYIGSgA">
<div class="kp-blk _Z7 _RJe">
<div class="xpdopen">
<div class="_OKe">
<div>
<div></div>
</div>
<div>
<div class="_tN _xHd qxsd _IWg _HWg _dXg _eXg _Dzh mod" data-md="32" style="clear:none">
<div style="position:relative" class="kno-mrg-hnm _NEh kno-mrg kno-swp" id="media_result_group" data-hveid="27">
View google_results_basic.html
<div class="g">
<div class="_uXc hp-xpdbox">
<div class="_x8d" style="float:right">
<div class="_i8d" style="height:110px;width:90px"><a href="https://www.londontoolkit.com/briefing/oystercard.htm?sa=X&amp;ved=0ahUKEwjI2Yi16_XNAhVDeT4KHbibBRkQ9QEIEDAA"><img src="https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcSR6qJABFxstZJrNbG-XkVrgaMvKd31aulUnHuXz6jF4Yc_sdctNhGQ8JQ" style="margin-left:-42px;margin-right:-43px" alt="Image result for oyster card price"></a></div>
</div>
<div class="_o0d">
<table class="_cmh" border="0" cellpadding="0" cellspacing="0">
<thead>
<tr>
<th class="_dmh">Oyster &amp; Contactless Payment Card Price Caps 2016 Compared To Travelcard Prices</th>
@endemic
endemic / flatten.rb
Last active May 20, 2016
Example "Array#flatten" implementation
View flatten.rb
def flatten(arg, results = [])
if arg.is_a?(Array)
arg.each do |val|
flatten(val, results)
end
else
results.push(arg)
end
return results
@endemic
endemic / cheatsheet.md
Created May 17, 2016
Ubuntu/Debian cheatsheet
View cheatsheet.md

update system

sudo apt-get update sudo apt-get upgrade

nginx config

/etc/nginx/nginx.conf /etc/nginx/sites-available/*

nginx logs

/var/log/nginx/access.log

You can’t perform that action at this time.