Skip to content

Instantly share code, notes, and snippets.

@Illvili
Illvili / gist:8b3557c880cd325b8624
Created December 19, 2014 08:12
Fix srcset on Chrome http over TLS
if ('https:' == self.location.protocol && /chrome/i.test(window.navigator.userAgent)) {
var srcset_elements = document.querySelectorAll('[srcset]');
if (!!window.devicePixelRatio && window.devicePixelRatio != 1) {
Array.prototype.forEach.call(srcset_elements, function (el) {
var prop = el.getAttribute('srcset');
var src_list = prop.split(/,\s*/);
var ratio = 0;
var src = '';
src_list.forEach(function(item) {
@Illvili
Illvili / app-icon-gen.php
Last active August 29, 2015 14:08
iOS App asset catalogs gen
<?php
if (!isset($argv[1])) {
echo '[!] Need image path', PHP_EOL;
echo $argv[0], ' [imagepath]', PHP_EOL;
exit(1);
}
$image = realpath($argv[1]);
@Illvili
Illvili / archive_log
Created September 16, 2013 08:33
ThinkPHP log archiver
#!/bin/sh
log_path="/home/www/[APP_NAME]/App/Runtime/Logs"
archive_path="/home/logs_archiver";
# some command
list_all_pattern="ls $log_path/13_*.log -1 | xargs -n 1 -I %_ basename %_ .log"
# archive files
Archive_Files () {
@Illvili
Illvili / ps-color.reg
Last active December 22, 2015 04:48
PowerShell Colors for http://stackoverflow.com/questions/1057564/pretty-git-branch-graphs NOTICE: color format OOGGRRBB
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Console\%SystemRoot%_system32_WindowsPowerShell_v1.0_powershell.exe]
; black 00000000
"ColorTable00"=dword:00202020
; darkgreen 00008000
"ColorTable01"=dword:004e4224
; darkred 00800000
"ColorTable02"=dword:001a5d14
; darkyellow 00808000