Skip to content

Instantly share code, notes, and snippets.

View AshishKapoor's full-sized avatar
🪂
Git gud, son!

AshishKapoor

🪂
Git gud, son!
View GitHub Profile
@AshishKapoor
AshishKapoor / multipleParantheses.js
Created August 16, 2019 07:11
How redux connect() works?
// Reference: https://stackoverflow.com/a/18234552/7393218
const message=[];
const say = (someString) => {
    if (someString) {
        message.push(someString);
        return say
    }
    console.log(message.join(' '));
}
@AshishKapoor
AshishKapoor / searchLetters.js
Last active August 10, 2019 11:58
Search letter wise in an array using JavaScript
// Search letter wise in an array using JavaScript
var words = ['spray', 'limit', 'elite', 'exuberant', 'destruction', 'present'];
const result = words.filter(word => word.indexOf('des') !== -1);
console.log(result); // > Array ["destruction"]
{
"meta": { "theme": "elegant" },
"basics": {
"name": "Ashish Kapoor",
"label": "Senior Software Engineer",
"picture": "https://avatars3.githubusercontent.com/u/5203107?s=400&u=a2ec71f26f786eef2d311a338d88cc02536f5fd2&v=4",
"email": "[email protected]",
"phone": "+91 9899 771 880",
"website": "https://medium.com/@kapoor",
"summary": "A process-oriented professional with over 6 years of experience in the software engineering discipline. Currently, a software consultant at Rill Data, former sr. software engineer at Quid, a science enthusiast, and sometimes a vocalist. Inclined towards solving problems in big data, automotive, and educational startups with extensive experience building technology platforms, apps, websites in many sectors, and holds a master's degree in computer applications. A machine learning, and music enthusiast. Also, the former organizer of the Swift Delhi meetup community.",
@AshishKapoor
AshishKapoor / README.md
Created July 8, 2018 12:27 — forked from hofmannsven/README.md
My simply MySQL Command Line Cheatsheet
@AshishKapoor
AshishKapoor / tmux-cheats.md
Created February 26, 2018 06:53 — forked from Starefossen/tmux-cheats.md
My personal tmux cheat sheet for working with sessions, windows, and panes. `NB` I have remapped the command prefix to `ctrl` + `a`.

Sessions

New Session

  • tmux new [-s name] [cmd] (:new) - new session

Switch Session

  • tmux ls (:ls) - list sessions
  • tmux switch [-t name] (:switch) - switches to an existing session
@AshishKapoor
AshishKapoor / HOF.swift
Created July 10, 2017 07:33
HOF quick ref
import UIKit
let numbers = [1,2,3,4,5,6,7,8,9]
struct Person {
let name: String
let age: Int
init(name: String, age: Int) {
self.name = name
@AshishKapoor
AshishKapoor / timeago.swift
Created July 6, 2017 16:00 — forked from minorbug/timeago.swift
"Time ago" function for Swift (based on MatthewYork's DateTools for Objective-C)
func timeAgoSinceDate(date:NSDate, numericDates:Bool) -> String {
let calendar = NSCalendar.currentCalendar()
let unitFlags = NSCalendarUnit.CalendarUnitMinute | NSCalendarUnit.CalendarUnitHour | NSCalendarUnit.CalendarUnitDay | NSCalendarUnit.CalendarUnitWeekOfYear | NSCalendarUnit.CalendarUnitMonth | NSCalendarUnit.CalendarUnitYear | NSCalendarUnit.CalendarUnitSecond
let now = NSDate()
let earliest = now.earlierDate(date)
let latest = (earliest == now) ? date : now
let components:NSDateComponents = calendar.components(unitFlags, fromDate: earliest, toDate: latest, options: nil)
if (components.year >= 2) {
return "\(components.year) years ago"
@AshishKapoor
AshishKapoor / CountryCodes.json
Created July 3, 2017 19:09
Country Codes in a json file for future reference.
[
{"name":"Israel","dial_code":"+972","code":"IL"},
{"name":"Afghanistan","dial_code":"+93","code":"AF"},
{"name":"Albania","dial_code":"+355","code":"AL"},
{"name":"Algeria","dial_code":"+213","code":"DZ"},
{"name":"AmericanSamoa","dial_code":"+1 684","code":"AS"},
{"name":"Andorra","dial_code":"+376","code":"AD"},
{"name":"Angola","dial_code":"+244","code":"AO"},
{"name":"Anguilla","dial_code":"+1 264","code":"AI"},
{"name":"Antigua and Barbuda","dial_code":"+1 268","code":"AG"},
@AshishKapoor
AshishKapoor / Stack-Generics.swift
Created May 13, 2017 14:08
Stack and Generics implementation in Swift 3.1
import UIKit
// Stack and Generics implementation in Swift 3.1
class Node<T> {
let value: T
var nextNode: Node<T>?
var prevNode: Node<T>?
init(value: T) {
@AshishKapoor
AshishKapoor / Stack.swift
Created May 13, 2017 13:27
Stack implementation in Swift 3.1
import UIKit
// Stack implementation in Swift 3.1
class Node {
let value: Int
var nextNode: Node?
init(value: Int) {
self.value = value