/* Events */
process.on('exit', function(code) {}) // Emitted when the process is about to exit
process.on('uncaughtException', function(err) {}) // Emitted when an exception bubbles all the way back to the event loop. (should not be used)
/* Properties */
This file contains hidden or 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
import java.util.Scanner; | |
public class Factorial { | |
public static int fact (int val) { | |
if (val == 0) | |
return 1; | |
return val * fact(val - 1); | |
} | |
This file contains hidden or 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
nodejs -e 'require("http").createServer((req, res) => { res.end("response"); }).listen(8080);' |
This file contains hidden or 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
require('http').createServer((req, res) => { | |
res.writeHead(200, { 'Content-Type': 'text/plain' }); | |
res.end('Hello World!\n'); | |
}).listen(8080); |
This is a collection of the most common commands I run while administering Postgres databases. The variables shown between the open and closed tags, "<" and ">", should be replaced with a name you choose. Postgres has multiple shortcut functions, starting with a forward slash, "". Any SQL command that is not a shortcut, must end with a semicolon, ";". You can use the keyboard UP and DOWN keys to scroll the history of previous commands you've run.
http://www.postgresql.org/download/linux/ubuntu/ https://help.ubuntu.com/community/PostgreSQL
This file contains hidden or 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
$(document).ready(function () { | |
var $btn = $('.btn'); | |
var $image = $('#img'); | |
function Filter (config) { | |
this.target = config.target; | |
this.image = config.image; | |
this.filters = config.filters; | |
this.support = config.support === undefined ? true : config.support; |
This file contains hidden or 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
#!/bin/bash | |
list=${PATH//:/' '} | |
list=${list//\}/' '} | |
list=${list//\{/' '} | |
color () { | |
if [ -z $1 ]; then | |
tput setaf 1 | |
else |
This file contains hidden or 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
# Fibo between 0 and 30. | |
len=30 | |
arr=() | |
for (( i = 0; i < len; i++ )); do | |
if (( i > 0 )); then | |
let arr[i]="arr[i - 1] + arr[i - 2]" | |
else | |
let arr[i]=i | |
fi |
This file contains hidden or 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
#include "stdio.h" | |
#include "string.h" | |
int main () { | |
char str[] = "hello"; | |
int len = strlen(str); | |
for (int i = len; i >= 0; i--) | |
printf("%c", str[i]); |