Linux installation notes (tested under Ubuntu 14.04LTS/12.04LTS), assuming VirtualBox is already installed on host.
<?php | |
/** | |
* stream - Handle raw input stream | |
* | |
* LICENSE: This source file is subject to version 3.01 of the GPL license | |
* that is available through the world-wide-web at the following URI: | |
* http://www.gnu.org/licenses/gpl.html. If you did not receive a copy of | |
* the GPL License and are unable to obtain it through the web, please | |
* |
They say that one of the pros of NodeJS is that you use the same language on the back-end and the front-end, so it's easy to share code between them. This sounds great in theory, but in practice the synchronous dependency handling in NodeJS works completely different than any client-side frameworks (which are asynchronous).
Usually that means that you end up copy-pasting your code between your NodeJS sources and your client-side sources, or you use some tool like Browserify, which is brilliant, but they add an extra step in the build process and most likely will conflict with the dependency handling of the framework of your choice (like AnularJS DI). I couldn't look in the mirror if I would call that code sharing.
Fortunately, with a couple of lines of boilerplate code, you can write a module which works in NodeJS and AngularJS as well without any modification.
No globals in the front-end, and dependencies will work. The isNode and isAngular va
$ cat test.js | |
function foo () { while (true) { } } | |
function bar () { return foo(); } | |
bar(); | |
$ node test.js & | |
$ gdb attach $(pidof node) | |
0x00000bf778c63d5f in ?? () | |
(gdb) b v8::internal::Runtime_StackGuard | |
Breakpoint 1 at 0x84a1f0 | |
(gdb) print 'v8::V8::TerminateExecution'(0) |
var _ = require( "lodash" ); | |
// Assume a collection that has: | |
// - age: Number | |
// - hasCat: Boolean | |
var people = require( "./people.json" ); | |
// ----------------------------------------------------------------------------------- // | |
// ----------------------------------------------------------------------------------- // |
Backbone is great but I continually found the default sorting method limited due to the following:
Disc 1, Disc 2, … Disc 10
would become Disc 1, Disc 10, Disc 2
With the help of Jim Palmer's naturalSort.js, I was able to integrate natrual sorting into Backbone.Collection
.
Backbone collections are automatically sorted and now, by simply adding sortType:"natural"
, your collections can be sorted naturally.
#!/bin/sh | |
echo "Start SSHD service" | |
systemctl enable sshd | |
systemctl start sshd | |
echo "Remove junky programs i hate" | |
dnf -y remove clipit asunder gnomebaker lxmusic gnumeric osmo pidgin xpad | |
echo "Upgrade system" |
Python syntax here : 2.7 - online REPL
Javascript ES6 via Babel transpilation - online REPL
import math
#!/bin/bash | |
wget https://dl.pstmn.io/download/latest/linux64 -O postman-linux-x64.tar.gz | |
sudo tar xvzf postman-linux-x64.tar.gz -C /opt | |
sudo ln -s /opt/Postman/Postman /usr/bin/postman | |
cat << EOF > ~/.local/share/applications/postman2.desktop | |
[Desktop Entry] | |
Name=Postman | |
GenericName=API Client |
Given a table...
CREATE TABLE foo (
id SERIAL PRIMARY KEY,
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
...
);