Skip to content

Instantly share code, notes, and snippets.

View AlexMihov's full-sized avatar
🐯

Alex Mihov AlexMihov

🐯
View GitHub Profile
@AlexMihov
AlexMihov / stasts.js
Created July 6, 2017 12:45
Show Stats
var collections = db.getCollectionNames();
for(var i = 0; i < collections.length; i++){
var name = collections[i];
if(name.substr(0, 6) != 'system'){
var c = db.getCollection(name).count() ;
if (c > 1000) print(name + ' - ' + c + ' records');
}
}
@AlexMihov
AlexMihov / multi_matrix.tex
Created November 16, 2014 19:58
Make multiple matrices in one line
\begin{equation}
P^+=\[ \left( \begin{array}{ccc}
1 & 0\\
0 & 0\end{array} \right)\]
P^-=\[ \left( \begin{array}{ccc}
0 & 0\\
0 & 1\end{array} \right)\]
\end{equation}
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
green='\033[0;32m'
@AlexMihov
AlexMihov / new_gist_file_0
Created October 3, 2014 12:09
Elasticsearch vs. relational DB
Relational DB ⇒ Databases ⇒ Tables ⇒ Rows ⇒ Columns
Elasticsearch ⇒ Indices ⇒ Types ⇒ Documents ⇒ Fields
@AlexMihov
AlexMihov / debug_php.php
Created July 29, 2014 23:12
PHP Debug Bar
<?php
use DebugBar\StandardDebugBar;
$debugbar = new StandardDebugBar();
$debugbarRenderer = $debugbar->getJavascriptRenderer();
$debugbar["messages"]->addMessage("hello world!");
?>
<html>
<head>
$file = 'log.txt';
// Open the file to get existing content
$current = file_get_contents($file);
// Append a new person to the file
$current .= "I did it!\n";
// Write the contents back to the file
file_put_contents($file, $current);
@AlexMihov
AlexMihov / countries.php
Created July 27, 2014 15:10
Array of countries and their Abbriviations
<?php
$countries = array
(
'AF' => 'Afghanistan',
'AX' => 'Aland Islands',
'AL' => 'Albania',
'DZ' => 'Algeria',
'AS' => 'American Samoa',
'AD' => 'Andorra',
function pad (n, width, z) {
z = z || '0';
n = n + '';
while (n.length < width) { n = z + n; }
return n;
}
@AlexMihov
AlexMihov / 0_reuse_code.js
Created April 18, 2014 20:09
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console