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
// GroupCharacters('abc', 2) | |
// ["ab", "c"] | |
function GroupCharacters(sourceString, groupLength) | |
{ | |
return sourceString.split('').reduce(function(groupedStrings, currentCharacter) { | |
var lastGrouping = groupedStrings.pop(); | |
if(lastGrouping.length < groupLength) | |
{ | |
lastGrouping += currentCharacter; |
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
// Creates a C++ GUID structure from a source string | |
// http://msdn.microsoft.com/en-us/library/windows/desktop/aa373931(v=vs.85).aspx | |
/* | |
typedef struct _GUID { | |
DWORD Data1; | |
WORD Data2; | |
WORD Data3; | |
BYTE Data4[8]; |
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 allCheckboxNodes = document.querySelectorAll('input[type=checkbox]'); | |
var allCheckboxes = Array.prototype.slice.call(allCheckboxNodes, 0); | |
allCheckboxes.forEach(function (node) | |
{ | |
node.setAttribute('checked', 'checked'); | |
}); |
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
DROP FUNCTION IF EXISTS gauss_cdf; | |
DELIMITER // | |
CREATE FUNCTION gauss_cdf(mean float, stdev float, x float) RETURNS float | |
BEGIN | |
set @z = (x - mean) / stdev; | |
set @b1 = 0.319381530; | |
set @b2 = -0.356563782; | |
set @b3 = 1.781477937; |
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
$('#stories .remove').each(function (idx, remove) { | |
$.post('https://www.storyworth.com' + $(remove).attr('href'), {action: 'remove'}); | |
}); |
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
gunzip -c backup.sql.gz | mysql -u root targetdatabasename |
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
brew rm FORMULA | |
brew rm $(join <(brew leaves) <(brew deps FORMULA)) |
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
git cherry-pick "stash@{0}" -m 1 |
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
for f in **/*.flac; do ffmpeg -i "$f" -aq 3 "${f%flac}mp3"; |
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
#!/bin/bash | |
# all-routers ff02::2 | |
# server1 fe80::f03c:91ff:1122:3344 | |
# server2 fe80::f03c:91ff:5566:7788 | |
exec /usr/local/sbin/pyv6na.py \ | |
2001:db8::1 \ | |
2001:db8::2 \ | |
--interface enp0s3 \ |