NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.
If you are not into long explanations, see [Paolo Bergantino’s answer][2].
NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.
If you are not into long explanations, see [Paolo Bergantino’s answer][2].
| CREATE TABLE audit_log ( | |
| username text, -- who did the change | |
| event_time_utc timestamp, -- when the event was recorded | |
| table_name text, -- contains schema-qualified table name | |
| operation text, -- INSERT, UPDATE, DELETE or TRUNCATE | |
| before_value json, -- the OLD tuple value | |
| after_value json -- the NEW tuple value | |
| ); | |
| CREATE OR REPLACE FUNCTION audit_trigger() |
| var mediaJSON = { "categories" : [ { "name" : "Movies", | |
| "videos" : [ | |
| { "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org", | |
| "sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ], | |
| "subtitle" : "By Blender Foundation", | |
| "thumb" : "images/BigBuckBunny.jpg", | |
| "title" : "Big Buck Bunny" | |
| }, | |
| { "description" : "The first Blender Open Movie from 2006", | |
| "sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ], |
given a database named db:
SELECT pg_terminate_backend(pid)
FROM pg_stat_activity
WHERE datname='db'
AND state = 'idle in transaction'
| Agnes en_US # Isn't it nice to have a computer that will talk to you? | |
| Albert en_US # I have a frog in my throat. No, I mean a real frog! | |
| Alex en_US # Most people recognize me by my voice. | |
| Alice it_IT # Salve, mi chiamo Alice e sono una voce italiana. | |
| Alva sv_SE # Hej, jag heter Alva. Jag är en svensk röst. | |
| Amelie fr_CA # Bonjour, je m’appelle Amelie. Je suis une voix canadienne. | |
| Anna de_DE # Hallo, ich heiße Anna und ich bin eine deutsche Stimme. | |
| Bad News en_US # The light you see at the end of the tunnel is the headlamp of a fast approaching train. | |
| Bahh en_US # Do not pull the wool over my eyes. | |
| Bells en_US # Time flies when you are having fun. |
| // Reference: http://stackoverflow.com/questions/4822471/count-number-of-lines-in-a-git-repository | |
| $ git ls-files | xargs wc -l |
| import React from 'react'; | |
| let lastScrollY = 0; | |
| let ticking = false; | |
| class App extends React.Component { | |
| componentDidMount() { | |
| window.addEventListener('scroll', this.handleScroll, true); | |
| } |
| # Set variables in .bashrc file | |
| # don't forget to change your path correctly! | |
| export GOPATH=$HOME/golang | |
| export GOROOT=/usr/local/opt/go/libexec | |
| export PATH=$PATH:$GOPATH/bin | |
| export PATH=$PATH:$GOROOT/bin |
| (function(window, document, undefined) { | |
| var Storage = {}; | |
| window.Storage = Storage; | |
| Storage.tracking = true; | |
| Storage.track = function() { | |
| Storage.tracking = !Storage.tracking; | |
| if (Storage.tracking) { | |
| console.log("Tracking storage performance."); |