Skip to content

Instantly share code, notes, and snippets.

@Syrup-tan
Syrup-tan / String.pad.js
Last active August 29, 2015 14:11
A simple string padding function written in ES5 with Closure compiler annotations
/**
* String.pad.js
* A simple string padding function written in ES5 with Closure compiler annotations
*/
/**
* Enum for the padding alignment
* @enum {number}
*/
@Syrup-tan
Syrup-tan / 0_ProjectEuler.md
Last active September 30, 2016 08:52
Project Euler

Project Euler

My attempt at weekly project euler solution

@Syrup-tan
Syrup-tan / Memoize.js
Last active August 29, 2015 14:15
Memoization function for ECMAScript
// Get the nth fibonacci number, starting from fib(0) == 1
var fib = Memoize(function(n) {
if (n == 0) return 1;
if (n == 1) return 1;
return fib(n - 1) + fib(n - 2);
});
<Proplex> so are we going to be posting donation receipts any time soon?
<irungentoo> the paypal ones might contain personal info
<Jfreegman> then we're doing it wrong
<Jfreegman> just blank out any personal info
<Proplex> ^
<Proplex> you have no idea how bad we look when we're not being transparent with MONEY.
<Jfreegman> agreed. i don't even think we should be taking donations right now if no one knows where they're going
<irungentoo> they are going nowhere
<irungentoo> they are not getting spent
<Proplex> then fucking prove it!
#!/bin/sh
## MySQL Setup Configuration
MYSQL_DATABASE='mydb_name';
MYSQL_USERNAME='mydb_user';
INCLUDE_DEVELOPER_DEFAULTS=false;
## Get the MySQL files
@Syrup-tan
Syrup-tan / search.bash
Last active August 29, 2015 14:18
A simple ZNC search script.
#!/bin/bash
## search.{bash,zsh} v0.0.3
## Configuration
LOG_DIR=~znc/'.znc/moddata/log/syrup-tan';
DEFAULT_SERVER='rizon';
## Usage
## Source the file with $ . ./search.bash
## All queries must begin with a from_* function
#!/bin/sh
## Configuration
OUTPUT=~/www/anya.txt;
## Get the search scripts
. ~/www/search.bash;
## Get all of the messages from Anya that contain danbooru
from_buffer '#r/a/dio' | grep_nick 'Anya' | grep 'danbooru' > "$OUTPUT";
@Syrup-tan
Syrup-tan / stdlib.sh
Created April 20, 2015 22:16
A simple standard library for posix sh, WIP
#!/bin/sh
## sh stdlib
plus_equals() { FUNCTION="plus_equals()";
## Handle options
case "$1" in
-h)
echo;
Example: https://denpa.moe/~syrup/himawari8.png
caesar(atob('TFdWIFFSVyBEUSBEVlZEVlZMUSwgTFdWIEQgUUxRTUQ7IFFSVyBZRFBTTFVILVJRSCwgV0tSWEpLLg=='), 23);
function caesar(s, n) {
n = n || 13;
var alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
return s.toUpperCase().replace(/./g, function(l) {
var index = alphabet.indexOf(l);
return index < 0 ? l : alphabet[(index + n) % 26];
});
}