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
import { | |
Server, | |
AuthService, | |
WebSocketService, | |
WebSocketInterface, | |
DbService | |
} from "serendip"; | |
export class DashboardService { | |
static dependencies = ["AuthService", "DbService", "WebSocketService"]; |
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
# زمان | |
حالا - اکنون - هنوز - همیشه - وقتی - قبلا - بعدا - سرانجام - اغلب - روزانه - در پایان - در نهایت - در خاتمه - ابتدا - گاه - بلافاصله - اخیرا - اخیراً | |
# تکرار | |
دوباره - باز - برای اولین بار - بارها | |
# مقدار | |
بیشتر - خیلی - تا حدی - بسیار - کم |
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
/* | |
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp | |
server, but for some reason omit a client connecting to it. I added an | |
example at the bottom. | |
Save the following server in example.js: | |
*/ | |
var net = require('net'); |
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
var http = require("http"); | |
var fs = require("fs"); | |
var server = http.createServer().listen(3000); | |
server.on("request", function(req, res) { | |
if (req.method != "POST") return res.end(); | |
var imageName = "received-" + Date.now() + ".jpg"; | |
var writeStream = fs.createWriteStream(imageName); | |
req.pipe(writeStream); |
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
for type in ts css html less json; do | |
echo "total lines of .$type files"; | |
lines=$(( find ./ -path './*/node_modules' -prune -o -name "*.$type" -print0 | xargs -0 cat ) | wc -l); | |
echo "$lines"; | |
done; | |
# example output: | |
# total lines of .ts files | |
# 34377 | |
# total lines of .css files |
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
convert "*.{png,jpeg}" -quality 100 outfile.pdf |
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
function memorySizeOf(obj) { | |
var bytes = 0; | |
function sizeOf(obj) { | |
if(obj !== null && obj !== undefined) { | |
switch(typeof obj) { | |
case 'number': | |
bytes += 8; | |
break; | |
case 'string': |
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
var fs = require('fs'), | |
util = require('util'), | |
Stream = require('stream').Stream; | |
/** | |
* Create a bandwidth limited stream | |
* | |
* This is a read+writeable stream that can limit how fast it | |
* is written onto by emitting pause and resume events to | |
* maintain a specified bandwidth limit, that limit can |
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
# inline if | |
echo "result: $(if [ $(pgrep -c "myApplication^C -eq 1 ]; then echo "true"; else echo "false"; fi)" | |
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
main_dir=~/Desktop/github-backups | |
github_users=(orgs/serendip-agency users/m-esm) | |
echo -e "\tBackup directory:$main_dir \n\n\tAccounts to backup:" | |
for a in ${github_users[@]}; do echo -e "\t\t${a}"; done | |
echo -e "\n\t$(mkdir $main_dir 2>&1)" | |
cd $main_dir | |
for user in ${github_users[@]}; do | |
repos=$(curl https://api.github.com/$user/repos --silent) | |
for row in $(echo "${repos}" | jq -r '.[] | @base64'); do | |
_jq() { echo ${row} | base64 --decode | jq -r ${1}; } |
OlderNewer