Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View antsmartian's full-sized avatar
💭
Hacking...

antsmartian antsmartian

💭
Hacking...
  • India
View GitHub Profile

Functors In JavaScript Space.

Functors are fancy terms in functional programming field. People from FP (like Haskell) background talks a lot about Functors in their day to day activities, however we as JavaScript developers, using Functors internally in all our application code base! Can't believe? Yes, we are using them without realizing! In this talk, we are going to create our own Functors in JavaScript and understand how real world use cases are solved by using Functors in JavaScript space.

@antsmartian
antsmartian / LEARNING.md
Last active May 11, 2019 20:30
Learning Postgres

Hello all, I'm in the process of learning Postgres and I find it very hard to find a resource where postgres is explained in terms of developer. Since I'm in the process of reading and applying it in my side project; I treat this gist as my knowledge sharing place on Postgres and its features. Each sub-heading tries to explain the concepts of Postgres with simple example. I may be wrong at times here, if so please free to comment.

All the codes are written and run on psql

I would be adding many stuffs as I learn them. There is no particular order in which I add the contents.

I'm using the following postgres version:

SELECT version();
var nested = [
{
"id": 484856,
"subject": {
"id": 100183,
"name": "Feather",
"type": "Post"
},
"url": "https://www.producthunt.com/posts/feather-5#comment-484856",
"created_at": "2017-06-18T16:49:28.842-07:00",
@antsmartian
antsmartian / cp.js
Last active February 9, 2017 09:22
combinations and permutations
function getCombinations(totalChars) {
var result = []
var fn = function(prefix, chars) {
for(let i=0;i<chars.length;i++) {
result.push(prefix + chars[i])
fn(prefix + chars[i],chars.slice(i+1))
}
}
fn('',totalChars);
return result
@antsmartian
antsmartian / rebortOnTheFly.vbs
Last active December 19, 2015 16:52
Vb report generation
'Helper class to generate html and
'handle file writing
Class HtmlReportGenerator
Private fileHandle
Private objFSO
Private objFile
Private Sub Class_Initialize()
set objFSO = CreateObject("Scripting.FileSystemObject")
@antsmartian
antsmartian / curryingLeadsToComposition.swift
Created October 18, 2015 06:46
curryingLeadsToComposition
//: Playground - noun: a place where people can play
import UIKit
func add(a: Int)(b: Int) -> Int {
return a + b
}
func div(a: Int)(b: Int) -> Int {
return a % b
//: Playground - noun: a place where people can play
import Foundation
func tablesOfTwo(x: Int) -> Int {
return 2 * x;
}
func tablesOfThree(x: Int) -> Int {
return 3 * x;
@antsmartian
antsmartian / closures.swift
Created October 18, 2015 05:32
Closures in swift
//: Playground - noun: a place where people can play
import Foundation
func tablesOfTwo(x: Int) -> Int {
return 2 * x;
}
func tablesOfThree(x: Int) -> Int {
return 3 * x;
@antsmartian
antsmartian / composition.swift
Created October 17, 2015 11:55
Composition In Swift
//: Playground - noun: a place where people can play
import Foundation
func getContents(url: String) -> String {
var a = url.componentsSeparatedByString(".")
var temp = ""
for (index, element) in enumerate(a) {
temp = "\(temp) \n \(element)";
}
@antsmartian
antsmartian / FlipkartCodingSession3.java
Created September 12, 2015 12:08
Flipkart Selenium Session 3
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.FluentWait;
import org.openqa.selenium.support.ui.WebDriverWait;