Skip to content

Instantly share code, notes, and snippets.

View GitHub30's full-sized avatar
🌴
On vacation

GitHub30

🌴
On vacation
  • Osaka, Japan
View GitHub Profile
#!/home/werewolf/PhantomJS/phantomjs/bin/phantomjs
var fs = require('fs');
var page = require('webpage').create();
var now = new Date().getTime();
page.onConsoleMessage = function(msg) {
fs.write("data.log", now + "\t" + msg + '\n', 'a');
};
<html>
<style>
.スタイル {
position: absolute;
top: 0;
right: 3%;
font-size: 70px;
color: #e75297;
font-family: 'Nunito', sans-serif;
text-shadow: #fff 1px 1px 0px, #fff -1px 1px 0px, #fff 1px -1px 0px, #fff -1px -1px 0px;
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
@GitHub30
GitHub30 / nav_kai.php
Last active January 19, 2016 01:21
php file
<?php
// example code
for ($i = 0; $i < 10; ++$i) {
print "i: $i\n";
}
$min = 0;
$offset = 100;
String.prototype.format = String.prototype.f = function(arg){
var is_object = typeof arg === 'object',
keys = is_object ? Object.keys(arg) : (function(l){for(i=0,a=[];i<l;i++)a[i]=i;return a;})(arguments.length),
args = is_object ? arg : arguments;
return this.replace( new RegExp('\\{(keys)\\}'.replace('keys', keys.join('|')), 'gm'), function(match, key){return args[key];});
}
String.prototype.f = function(arg){
var args = typeof arg === 'object' ? arg : arguments,
keys = Object.keys(args).map(function(s){return s.replace(/\\|\(|\)|\|/g,'\\$&');}).join('|');
return this.replace(new RegExp('\\{('+keys+')\\}', 'gm'), function(match, key){return args[key];});
}
@GitHub30
GitHub30 / type_for_mysql.js
Last active May 1, 2016 09:09
Type for MySQL
var type_for_mysql = function(data) {
if (data === null)
return 'NULL';
var type = typeof data;
if (type === 'boolean')
return 'BOOLEAN';
else if (type === 'number')
return 'INTEGER';
else if (type === 'string')
@GitHub30
GitHub30 / readable_size.js
Created July 29, 2016 22:58
readable_size.js
function readable_size(size){
var units = ['B', 'KB', 'MB', 'GB', 'TB'];
var i = Math.floor(Math.log(size)/Math.log(1024));
return Math.floor(size/Math.pow(1024, i)) + units[i];
}
@GitHub30
GitHub30 / Install_wallpaper.sh
Created August 21, 2016 11:11
Install all wallpaper for Ubuntu
sudo apt install ubuntu-wallpapers-*
SQL_MODES = 'STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'.split(',')
if 'STRICT_TRANS_TABLES' in SQL_MODES:
SQL_MODES.remove('STRICT_TRANS_TABLES')
','.join(SQL_MODES)