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
protected function checkInputDate($string) | |
{ | |
$try = date_parse($string); | |
if ($try['error_count'] > 0) | |
return false; | |
try { $try = new DateTime($string); } | |
catch (Exception $e) { return false; } | |
$sep = '-.\/'; |
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
WARNING! Be very careful that you do not accidentally disable all ways that you can click. If you have reassigned your left click button to another function, and then you uncheck "Enable" on one finger tapping in the GUI, you will have to plug in an external USB mouse or remote into the machine with remote desktop (or something similar) or use Windows Speech Recognition or figure out some other way to re-check the "Enable" box under one finger tapping in the GUI in order to restore click functionality. I will not be held responsible if you do not have any of these methods available and you end up (temporarily) bricking your laptop. You have been warned. (But really, just don't uncheck that box and you will be fine). | |
HKEY_CURRENT_USER\Software\Elantech\SmartPad: | |
Button_Left; Button_Right; Tap_Two_Finger; Tap_Three_Finger; ThreeFingerMoveUp_Func; ThreeFingerMoveDown_Func: | |
0 Click/Select | |
Left click default | |
1 Pop-up Menu | |
Right Click default | |
2 Middle Button |
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
function _color_rgb2hsl($rgb) { | |
$r = $rgb[0]; | |
$g = $rgb[1]; | |
$b = $rgb[2]; | |
$min = min($r, min($g, $b)); | |
$max = max($r, max($g, $b)); | |
$delta = $max - $min; | |
$l = ($min + $max) / 2; | |
$s = 0; | |
if ($l > 0 && $l < 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
/* | |
backup_tables('localhost','root','root','esvec'); | |
*/ | |
/* backup the db OR just a table */ | |
function backup_tables($host,$user,$pass,$name,$tables = '*') | |
{ | |
$return = null; | |
$link = mysql_connect($host,$user,$pass); |
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
/** | |
* Breaksdown a timestamp into an array of days, months, etc since the current time | |
* @author http://milesj.me/snippets/php/timeBreakdown | |
* @param int $timeStamp | |
* @return array | |
*/ | |
function timeBreakdown($timeStamp) { | |
if (!is_int($timeStamp)) $timeStamp = strtotime($timeStamp); | |
$currentTime = time(); | |
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
(function (doc) { | |
var xhr = new XMLHttpRequest(); | |
xhr.onload = function () { | |
var div = doc.createElement('div'); | |
div.innerHTML = this.responseText; | |
// div.style.display = 'none'; -- causes gradients not to render! | |
div.style.visibility = 'hidden'; | |
div.style.position = 'absolute'; | |
div.style.height = 0; | |
div.style.width = 0; |
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
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\TimeBroker] | |
"Start"=dword:00000003 | |
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SysMain] | |
"DisplayName"="Superfetch" | |
"Start"=dword:00000003 |
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
# Converting date to number of days | |
# Useful when you need to add few days and get a date | |
# https://en.wikipedia.org/wiki/Julian_day | |
def toJND(day,month,year): | |
a = (14-month)//12 | |
y = year + 4800 - a | |
m = month + 12*a - 3 | |
return day + (153*m+2)//5 + 365*y + y//4 - 32083 |
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
import tensorflow as tf | |
class EvoNetwork: | |
def __init__(self, input_size, weights, use_biases=False): | |
with tf.Graph().as_default(): | |
self.inputs = tf.placeholder(tf.float32, [None, input_size]) | |
hidden_layer = self.inputs | |
for i, weight in enumerate(weights): | |
with tf.variable_scope('hidden_layer_{}'.format(i)): |
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
Mahalanobis distance dM(x,x′)^2 = (x − x′)^T M (x − x′) | |
where M is cone of symmetric PSD d*d matrix | |
Must-link / cannot-link constraints (sometimes called positive / negative pairs): | |
S = {(xi, xj) : xi and xj should be similar}, | |
D = {(xi, xj) : xi and xj should be dissimilar}. | |
Relative constraints (sometimes called training triplets): | |
R = {(xi, xj , xk) : xi should be more similar to xj than to xk}. | |
Optimization problem that has the following general form: min M { ℓ(M, S,D,R) + λR(M) } |
OlderNewer