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 sanitize(object) { | |
if (_.isString(object)) return _sanitizeString(object); | |
if (_.isArray(object)) return _sanitizeArray(object); | |
if (_.isPlainObject(object)) return _sanitizeObject(object); | |
return object; | |
} | |
function _sanitizeString(string) { | |
return _.isEmpty(string) ? null : string; | |
} |
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
$> mysql --host=127.0.0.1 --protocol=TCP --user=root --password=password | |
mysql> SET GLOBAL log_output=FILE; | |
mysql> SET GLOBAL log_queries_not_using_indexes=ON; | |
mysql> SET GLOBAL long_query_time=0.1; | |
mysql> SET GLOBAL slow_query_log=ON; | |
mysql> SET GLOBAL slow_query_log_file='/var/log/mysql/slow-query.log'; |
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
// Props to : http://nathanleclaire.com/blog/2013/11/16/the-javascript-question-i-bombed-in-an-interview-with-a-y-combinator-startup/ | |
var processOnTime = function ( next, delay ) { | |
var d = delay; | |
if ( ! next ) { | |
throw new ReferenceError(); | |
} | |
if ( ! d || isNaN ( d ) ) { | |
d = 200; |
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
#!/usr/bin/env sh | |
# Warning! This script is a work in progress. | |
# | |
# The sript is buggy since logout/restarts are needed between some steps (zsh or docker I guess) | |
# but it's a good reminder of what needs to be done to setup a new machine. | |
main () { | |
install_prerequisites | |
install_and_configure_zsh |
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
export PATH=$HOME/bin:/usr/local/bin:$PATH | |
export ZSH="$HOME/.oh-my-zsh" | |
ZSH_THEME="avit" | |
HYPHEN_INSENSITIVE="true" | |
COMPLETION_WAITING_DOTS="true" | |
plugins=(autojump common-aliases docker extract httpie docker docker-compose kubectl) | |
source $ZSH/oh-my-zsh.sh |
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
@RestController | |
public class HealthcheckApi { | |
private final SayImAlive sayImAlive; | |
public HealthcheckApi(SayImAlive sayImAlive) { | |
this.sayImAlive = sayImAlive; | |
} | |
@RequestMapping(value = "/healthcheck") |
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
#!/usr/bin/env bash | |
set -o errexit | |
set -o nounset | |
set -o xtrace | |
# Script goes here... |
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
mysql> EXPLAIN SELECT SQL_NO_CACHE * FROM articles WHERE article_id = '150001'; | |
+----+-------------+----------+------------+-------+---------------+---------+---------+-------+------+----------+-------+ | |
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra | | |
+----+-------------+----------+------------+-------+---------------+---------+---------+-------+------+----------+-------+ | |
| 1 | SIMPLE | articles | NULL | const | PRIMARY | PRIMARY | 34 | const | 1 | 100.00 | NULL | | |
+----+-------------+----------+------------+-------+---------------+---------+---------+-------+------+----------+-------+ | |
1 row in set, 1 warning (0.00 sec) |
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
mysql> SELECT SQL_NO_CACHE * FROM articles WHERE article_id = '150000'; | |
+------------+---------------+-----------------+ | |
| article_id | article_title | article_content | | |
+------------+---------------+-----------------+ | |
| 150000 | Title 150000 | Content 150000 | | |
+------------+---------------+-----------------+ | |
1 row in set (0.00 sec) |
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
mysql> SELECT SQL_NO_CACHE * FROM articles WHERE article_id = 150000; |
NewerOlder