Skip to content

Instantly share code, notes, and snippets.

@manjeettahkur
manjeettahkur / .golangci.yaml
Created June 1, 2022 01:57
Code conventions, Practice and Tooling Group -- Linter Settings
linters-settings:
govet:
check-shadowing: true
settings:
printf:
funcs:
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
@manjeettahkur
manjeettahkur / LambdaConstants.java
Created May 25, 2022 15:53 — forked from seeebiii/LambdaConstants.java
Available default environment variables in AWS Lambda. Just copy&paste into your Node or Java project.
public class Constants {
/**
* Contains the path to your Lambda function code.
*/
public static final String LAMBDA_TASK_ROOT = System.getenv("LAMBDA_TASK_ROOT");
/**
* The environment variable is set to one of the following options, depending on the runtime of the Lambda function:
* AWS_Lambda_nodejs, AWS_Lambda_nodejs4.3, AWS_Lambda_nodejs6.10
// by: throw_away_stacy on reddit
// and yes I do birthday parties too
const WebSocket = require('websocket').w3cwebsocket;
const users = require('./users.json');
const Q = require('q');
const superagent = require('superagent');
const _ = require('highland');
const getPixels = require('get-pixels');
@manjeettahkur
manjeettahkur / redisjobqueue.go
Created March 19, 2020 06:28 — forked from brunocassol/redisjobqueue.go
A simple demo implementation of a Redis job queue in Go inspired on http://stackoverflow.com/a/34754632
package main
// A simple demo implementation of a Redis job queue in Go inspired on http://stackoverflow.com/a/34754632
// You'll need to get redis driver package in terminal with: go get -u gopkg.in/redis.v5
// Once it is running, Redis should look like: http://i.imgur.com/P4XlwlP.png
// Terminal should look like: http://i.imgur.com/AS2IIbP.png
// I have 4 days of Go programming experience, have mercy.
import (
"fmt"
@manjeettahkur
manjeettahkur / fibonacci.go
Created November 10, 2018 15:06 — forked from PetrGlad/fibonacci.go
My exercises for "A tour of Go"
func fibonacci_seq() func() int {
f1, f2 := 0, 1
return func() int {
f1, f2 = f2, f1 + f2
return f2
}
}
package main
import "fmt"
// 定义接口类型 PeopleGetter 包含获取基本信息的方法
type PeopleGetter interface {
GetName() string
GetAge() int
}
@manjeettahkur
manjeettahkur / exercise.tour.go
Created March 14, 2018 13:08 — forked from zyxar/exercise.tour.go
tour.golang exercise solutions
/* Exercise: Loops and Functions #43 */
package main
import (
"fmt"
"math"
)
func Sqrt(x float64) float64 {
z := float64(2.)
@manjeettahkur
manjeettahkur / 01-controllers-to-components.md
Created June 19, 2017 06:56 — forked from dimitardanailov/01-controllers-to-components.md
Angular 2 and Typescript. Thank you to John Papa for awesome online course: http://www.johnpapa.net/angular-2-first-look

Angular 1

<body ng-controller="StoryController as vm">
  <h3>{{ vm.story.name }}</h3>
  <h3 ng-bind="vm.story.name"></h3>
</body>
@manjeettahkur
manjeettahkur / array_iteration_thoughts.md
Created January 23, 2017 10:30 — forked from ljharb/array_iteration_thoughts.md
Array iteration methods summarized

While attempting to explain JavaScript's reduce method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.

Intro

JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it much simpler to think about both the old list and the new one, what they contain, and

@manjeettahkur
manjeettahkur / closure.js
Created June 4, 2016 13:50 — forked from nowk/closure.js
Javascript Closure practice
/* jshint node: true */
var assert = require("assert");
/*
* fn
*
* @return {Function}
*/