Skip to content

Instantly share code, notes, and snippets.

View nanashiRei's full-sized avatar

David Marner nanashiRei

View GitHub Profile
#!/usr/bin/perl -w
#
# splitmysqldump - split mysqldump file into per-database dump files.
use strict;
use warnings;
my $dbfile;
my $dbname = q{};
my $header = q{};
while (<>) {
@nanashiRei
nanashiRei / FormatHelper.class.php
Last active December 24, 2015 07:19
Size Formatter
<?php
class FormatHelper {
static public function niceSize($bytes, $digits = 2) {
$format = "%0.{$digits}f %s";
$sizeObj = self::bytesHumnaized($bytes);
return sprintf($format, $sizeObj->value, $sizeObj->extension);
}
static public function bytesHumanized($bytes, $step = 1024) {
<?php
/**
* singleton pattern class
*/
class Singleton {
public static function getInstance() {
static $instance;
if (static::$instance == null) {
static::$instance == new self();
}
@nanashiRei
nanashiRei / style.css
Created April 12, 2013 18:56
JSON View (Google Chrome Plugin) - Dark Style
body {
white-space: pre;
font-family: monospace;
background: #222;
color: #ccc;
}
.property {
font-weight: normal;
font-style: italic;
select
count(0) AS `downloads`,
`d`.`timestamp` AS `timestamp`,
'Pack' AS `dltype`,
`p`.`size` AS `size`,
concat(`t`.`theme`,' #',`p`.`packnum`) AS `name`,
`p`.`beatmaps` AS `files`,
`p`.`downloads` AS `totaldownloads`,
concat_ws(';',`t`.`id`,`t`.`theme`,`p`.`packnum`) AS `linkdata`
from