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
# Type 'notepad $profile' to open your profile ps1 file and add | |
# This will add the file if it doesn't exist or update the | |
# last write time if it does | |
# If you get some message about not being able to run scripts then you need to type the following command and restart powershell | |
# Set-ExecutionPolicy Bypass | |
Function touch { | |
$file = $args[0] | |
if($file -eq $null) { |
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
const isString = value => typeof value === 'string' || value instanceof String; | |
/* | |
camelCase('camel case'); // camelCase | |
camelCase('camel_case'); // camelCase | |
camelCase('camel-case'); // camelCase | |
*/ | |
const camelCase = str => { | |
if(!isString(str)) { | |
return ''; |
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
<template> | |
</template> | |
<script> | |
import { mapState, mapGetters, mapActions } from 'vuex'; | |
import * as types from './../store/action_types'; | |
export default { | |
components: { }, |
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
db.getCollection('collection').aggregate([ | |
{ $match: { $and: [ | |
{ created_at: { $exists: true } }, | |
{ created_at: { $ne: null } } | |
] } }, | |
{ $project: { | |
month: { $month: "$created_at" }, | |
year: { $year: "$created_at" }, | |
day: { $dayOfMonth: "$created_at" } } }, | |
{ $group: { _id: { "year": "$year", "month": "$month", "day": "$day" } } }, |
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
/* | |
db.setProfilingLevel(2) Needs to be ran first | |
0 - Off | |
1 - Only slow | |
2 - all | |
This enables query profiling, after enabling profiling, run the application for a bit to get some data. | |
*/ | |
db.getCollection('system.profile') | |
.find({ |
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
<!-- From Mathias Bynens' blog post 'Everything you always wanted to know about touch icons' (http://mathiasbynens.be/notes/touch-icons) --> | |
<!-- For third-generation iPad with high-resolution Retina display: --> | |
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="apple-touch-icon-144x144-precomposed.png"> | |
<!-- For iPhone with high-resolution Retina display: --> | |
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="apple-touch-icon-114x114-precomposed.png"> | |
<!-- For first- and second-generation iPad: --> | |
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="apple-touch-icon-72x72-precomposed.png"> |
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
-- Line 9 equals indexes | |
SELECT nspname || '.' || relname AS "relation", | |
pg_size_pretty(pg_total_relation_size(C.oid)) AS "total_size" | |
FROM pg_class C | |
LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace) | |
WHERE nspname NOT IN ('pg_catalog', 'information_schema') | |
AND C.relkind = 'i' | |
AND nspname !~ '^pg_toast' |
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
-- Line 9 ignores indexes | |
SELECT nspname || '.' || relname AS "relation", | |
pg_size_pretty(pg_total_relation_size(C.oid)) AS "total_size" | |
FROM pg_class C | |
LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace) | |
WHERE nspname NOT IN ('pg_catalog', 'information_schema') | |
AND C.relkind != 'i' | |
AND nspname !~ '^pg_toast' |
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
-- Relations, as in, tables and indexes | |
SELECT nspname || '.' || relname AS "relation", | |
pg_size_pretty(pg_relation_size(PC.oid)) AS "size" | |
FROM pg_class PC | |
LEFT JOIN pg_namespace NS ON (NS.oid = PC.relnamespace) | |
WHERE nspname NOT IN ('pg_catalog', 'information_schema') | |
AND nspname !~ '^pg_toast' | |
ORDER BY pg_relation_size(PC.oid) DESC |
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
SELECT d.datname AS Name, pg_catalog.pg_get_userbyid(d.datdba) AS Owner, | |
CASE WHEN pg_catalog.has_database_privilege(d.datname, 'CONNECT') | |
THEN pg_catalog.pg_size_pretty(pg_catalog.pg_database_size(d.datname)) | |
ELSE 'No Access' | |
END AS SIZE | |
FROM pg_catalog.pg_database d | |
ORDER BY | |
CASE WHEN pg_catalog.has_database_privilege(d.datname, 'CONNECT') | |
THEN pg_catalog.pg_database_size(d.datname) | |
ELSE NULL |