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
Cards.prototype.sort = function() { | |
this.sorted_hearts = []; | |
this.sorted_diamonds = []; | |
this.sorted_clubs = []; | |
this.sorted_spades = []; | |
for(var i = 0; i < this.deck.length; i++) { | |
var rs = this.deck[i].split(' '); | |
var num = 0 | |
if(rs[0] == 'A') num = 1; // Ace | |
else if(rs[0] == 'J') num = 11; // Jack |
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 isTouchScreenDevice() { | |
var isTouch = false; | |
var ua = navigator.userAgent; | |
if(ua.indexOf("Mobile") !== -1 || ua.indexOf("Tablet") !== -1) { | |
isTouch = true; | |
} | |
return isTouch; | |
} | |
window.onload = function() { |
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
import sys | |
import base64 | |
with open(sys.argv[1], 'rb') as binary_file: | |
encoded_string = base64.b64encode(binary_file.read()) | |
print(encoded_string) |
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
<script> | |
function format() { | |
var text = document.getElementById('formatter').value; | |
text = '\'' + text + '\'' | |
i = 0 | |
x = 1 | |
var newText = ''; | |
for(var i = 0; i < text.length; i++) { | |
if(x == 40) { |
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
# Serve to outside world on port 2015. | |
0.0.0.0:2015 | |
# This rewrite stops caddy.sh being served. | |
rewrite { | |
regexp caddy\.sh | |
to / | |
} |
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
# | |
# Dockerfile for a container that provides Node.js and MongoDB. | |
# saintpettersens/nodemongodb | |
# | |
# Use Ubuntu as base for container. | |
FROM ubuntu | |
# Install MongoDB. | |
ENV mongorepo "http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" |
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
/* | |
Michael Jasper's (@mdjasper) wrap DOM element function. | |
From: http://www.mikedoesweb.com/2014/wrapping-an-element-in-vanilla-javascript/ | |
*/ | |
function wrap(top, selector, bottom){ | |
var matches = document.querySelectorAll(selector); | |
for (var i = 0; i < matches.length; i++){ | |
var modified = top + matches[i].outerHTML + bottom; | |
matches[i].outerHTML = modified; | |
} |
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
'use strict'; | |
const wav = require('wav'); | |
const BinaryServer = require('binaryjs').BinaryServer; | |
let server = BinaryServer({port: 8080}); | |
let out = null; | |
server.on('connection', function(client) { | |
client.on('stream', function(stream, meta) { |
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
'use strict'; | |
const ogg = require('ogg'); | |
const vorbis = require('vorbis'); | |
const BinaryServer = require('binaryjs').BinaryServer; | |
let server = BinaryServer({port: 8080}); | |
let oe = new ogg.Encoder(); | |
let ve = new vorbis.Encoder(); | |
let out = null; |
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
start %* |