This file contains 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
// Load the TCP Library | |
net = require('net'); | |
// Keep track of the chat clients | |
var clients = []; | |
// Start a TCP Server | |
net.createServer(function (socket) { | |
// Identify this client |
This file contains 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)scii(B)inary(C)onverter | |
// (c) 2013 Stephan Schmitz <eyecatchup@gmail.com> | |
var ABC = { | |
toAscii: function(bin) { | |
return bin.replace(/\s*[01]{8}\s*/g, function(bin) { | |
return String.fromCharCode(parseInt(bin, 2)) | |
}) | |
}, | |
toBinary: function(str, spaceSeparatedOctets) { | |
return str.replace(/[\s\S]/g, function(str) { |
This file contains 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
<?php | |
require 'Struct.php'; | |
// define a 'coordinates' struct with 3 properties | |
$coords = Struct::factory('degree', 'minute', 'second' ,'pole'); | |
// create 2 latitude/longitude numbers | |
$lat = $coords->create(35, 41, 5.4816, 'N'); | |
$lng = $coords->create(139, 45, 56.6958, 'E'); | |
This file contains 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
<?php | |
$time1 = explode(' ', microtime()); | |
$time1 = $time1[1] . substr($time1[0], 1, -2); | |
// your code | |
$time2 = explode(' ', microtime()); | |
$time2 = $time2[1] . substr($time2[0], 1, -2); | |
This file contains 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
@echo off | |
@echo This batchfile changes your password 30 times into a temporary password, and finally into your given password. | |
@echo This way, you can use your 'old' password, when you are forced to change it ;) | |
SET /P user=username: | |
SET /P pwd=password: | |
echo username: %user% | |
net user %user% C6us4deSAf /domain |
This file contains 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
// | |
// asyncParallel(tasks, [callback]) | |
// | |
// Run an array of functions in parallel, without waiting until the previous | |
// function has completed. Once the tasks have completed, final callback is called. | |
// | |
// Source: | |
// https://gist.github.com/branneman/4541190 | |
// Inspired by: | |
// https://github.com/caolan/async#parallel |
This file contains 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'), | |
exec = require('child_process').exec, | |
express = require('express'), | |
app = express(); | |
app.get('/static/img/*.svg.*.png', function(req, res) { | |
var pngFile = 'src' + req.url, | |
svgFile = pngFile.substring(0, pngFile.indexOf('.svg') + 4); | |
if (!fs.existsSync(svgFile)) { | |
return res.render('404', { |
This file contains 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() { | |
var resizeEnd; | |
$(window).on('resize', function() { | |
clearTimeout(resizeEnd); | |
resizeEnd = setTimeout(function() { | |
$(window).trigger('resizeEnd'); |
This file contains 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 dump($var) { | |
ob_start(); | |
var_dump($var); | |
$output = ob_get_clean(); | |
echo preg_replace("/=>(\s+)/m", ' => ', $output); | |
} |
This file contains 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
/** | |
* Strict mode | |
* Opt in to a restricted variant of JavaScript. | |
*/ | |
'use strict'; | |
(function() { 'use strict'; }); | |
/** | |
* Array.prototype.forEach() | |
* Executes a provided function once per array element. |