Skip to content

Instantly share code, notes, and snippets.

View MuthukumarHelios's full-sized avatar

muthukumarHelios MuthukumarHelios

View GitHub Profile
@kenshinx
kenshinx / client.go
Last active February 3, 2024 18:49
golang socket server & client ping-pong demo
package main
import (
"os"
"log"
"net"
"strconv"
"strings"
)
@robwormald
robwormald / find.js
Last active February 13, 2017 10:01 — forked from Samstiles/find.js
/**
* Find Records
*
* An API call to find and return model instances from the data adapter
* using the specified criteria. If an id was specified, just the instance
* with that unique id will be returned.
*
* @param {Integer|String} id - the unique id of the particular instance you'd like to look up
* @param {Object} where - the find criteria (passed directly to the ORM)
* @param {Integer} limit - the maximum number of records to send back (useful for pagination)
@evanscottgray
evanscottgray / docker_kill.sh
Last active November 7, 2023 03:40
kill all docker containers at once...
docker ps | awk {' print $1 '} | tail -n+2 > tmp.txt; for line in $(cat tmp.txt); do docker kill $line; done; rm tmp.txt
@chrisnicola
chrisnicola / angularjs.md
Created March 20, 2014 20:25
AngularJS Tutorial Syllabus

Course Outline

  • 1 Overview of AngularJS (1hr)
    • 1.1 AngularJS architecture overview
    • 1.2 The Angular Batarang
    • 1.3 Using Karma
    • 1.4 Get Setup
    • 1.5 Angular Seed Tour
    • 1.6 Build: Hello World
  • Bind tweet to input
@agendor
agendor / hapijs-rest-api-tutorial.md
Last active August 31, 2021 08:31
A practical introduction to building a RESTful API with the hapi.js server framework for Node.js
@slav123
slav123 / doPut.go
Created August 18, 2014 04:20
PUT request GO LANG
func doPut(url string) {
client := &http.Client{}
request, err := http.NewRequest("PUT", url, strings.NewReader("<golang>really</golang>"))
request.SetBasicAuth("admin", "admin")
request.ContentLength = 23
response, err := client.Do(request)
if err != nil {
log.Fatal(err)
} else {
defer response.Body.Close()
@learncodeacademy
learncodeacademy / cluster.md
Created October 9, 2014 18:11
Node Cluster - Enhance your node app by using all the cores of your processor.

Here's all you have to do to add clustering to your node.js application.

  • save this code as cluster.js, and run cluster.js instead of server.js (or /bin/www, or whatever it's called for your project)
  • the only line you'll need to change is the last line - it needs to point to the location of your server.js file
var cluster = require('cluster');

if (cluster.isMaster) {
  // Count the machine's CPUs
 var cpuCount = require('os').cpus().length;
@psi-4ward
psi-4ward / LoginController.js
Created January 12, 2015 16:09
Sails.JS JWT Auth
// controllers/LoginController.js
module.exports = {
index: function(req, res) {
var email = req.param('email');
var password = req.param('password');
// delay everthing to prevent bruteforce, dos and timing attacks
setTimeout(function() {
@soheilhy
soheilhy / mochatutorial.md
Last active March 18, 2022 05:23
Mocha Tutorial

Testing Node.JS applications using Mocha

Mocha is a unittest framework for Node. In this document, we explain how you can test your javascript code and also your HTTP servers.

Installing Mocha

Use npm to install Mocha:

npm install mocha
@p4tin
p4tin / Mongo.go
Created December 13, 2015 18:06
Golang Mongo CRUD Example
package mongo
import (
"time"
"log"
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)
// Profile - is the memory representation of one user profile