This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let text = "There’s an interesting discussion on Quora about the differences between Golang and Scala. As a former academic with tendencies towards functional programming, I used to be very tempted by Scala.1 It offers all the functional goodness without the exoticism of Haskell, and came with reasonably good tools and frameworks. Like Clojure, it’s a functional language you can actually do some work with. The problem with Scala is, the more advanced you get, the more complicated (unreadable?) your code becomes. I remember that back in grad school the dude who was able to doodle the craziest and mathematically most challenging solution to some problem in Haskell was someone everyone looked up to. But it turns out in the “real world” simplicity always trumps virtuosity and sophistication, which is one of the many reasons I love Golang so much. A language with no “magic,” good concurrency support, great documentation and community that compiles into machine code and runs faster than Python? Yes, please. Read th |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#blog.oscarmorrison.com | |
#Cat feeder (open and close server) | |
#change the pin, and port here. | |
from flask import Flask, jsonify | |
import RPi.GPIO as IO | |
import time | |
pinOut = 4 | |
app = Flask(__name__) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const uniqueArray = function(array) { | |
return array.filter(function (item, pos) { | |
return array.indexOf(item) == pos; | |
}) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('a[href^=http]').each(function(){ | |
if(this.href.indexOf(location.hostname) < 0) { | |
$(this).attr({target: '_blank'}); | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*jslint node: true */ | |
/*jshint esversion: 6 */ | |
'use strict'; | |
var Nightmare = require('nightmare'); | |
var moment = require('moment'); | |
var debug = false; | |
var nightmare = new Nightmare({ | |
show: debug, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import os | |
import socket | |
import sys | |
def encode_packet(data): | |
output = bytearray() | |
for i in range(0, len(data)): | |
tmpoutput = bytearray([0, data[i]]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
var filePath = 'js/data/data.json'; | |
var outputPath = 'sitemap.xml'; | |
var date = new Date().toISOString(); | |
var header = '<?xml version="1.0" encoding="UTF-8"?>\n<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">\n'; | |
var baseUrl = 'http://getfreestuff.co/'; | |
fs.readFile(filePath, 'utf8', function(err, data){ | |
var json = JSON.parse(data); | |
var urls = []; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://github.com/youUsername/repoName.git | |
# https://waffle.io/youUsername/repoName | |
url=$(git config --get remote.origin.url) | |
url=$( tr '[A-Z]' '[a-z]' <<< $url) | |
url=${url%.git} | |
url="${url/github.com/waffle.io}" | |
echo $url | |
open $url |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<img src="img/missing-image.png" onerror="javascript:this.src='img/default.png'"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function matchString(stringOne, stringTwo, tolerance){ | |
stringOne = stringOne.toLowerCase().replace(/ /g,''); | |
stringTwo = stringTwo.toLowerCase().replace(/ /g,''); | |
var minLen = Math.max(stringOne.length, stringTwo.length); | |
var bigLen = Math.min(stringOne.length, stringTwo.length); | |
for(var i = 0, count = 0; i < minLen; i++){ | |
if(stringOne[i] === stringTwo[i]){ | |
count++; | |
} | |
} |