Skip to content

Instantly share code, notes, and snippets.

View ashok-khanna's full-sized avatar
🏠
Working from home

Ashok Khanna ashok-khanna

🏠
Working from home
View GitHub Profile
@sunilw
sunilw / package.json
Created January 23, 2022 05:01
ebuild simple project
{
"name": "react tut",
"version": "0.0.1",
"description": "Steps towards a more sufficient build pipeline",
"main": "index.js",
"watch": {
"sass": {
"patterns": [
"./src/sass"
],
@lukego
lukego / 0README.md
Last active July 4, 2024 15:49
CLIME installation instructions
(ql:quickload '("clack" "lack" "lack-middleware-mount" "cl-dotenv" "quri" "uuid" "dexador" "jsown"))
(defpackage #:example
(:use #:common-lisp))
(in-package #:example)
(.env:load-env (merge-pathnames ".env"))
(defvar *okta-authorize-uri* (quri:uri (uiop:getenv "OKTA_AUTHORIZE_URI")))
@death
death / tfidf.lisp
Created April 8, 2020 16:05
tfidf
;; Suppose we have a collection of N documents.
;; Define Fij to be the frequency of term i in document j.
;; Define TFij to be Fij/max(k,Fkj),
;; that is, the term frequency of term i in document j is Fij
;; normalized by dividing it by the maximum number of occurrences
;; of any term in the same document.
;; Define IDFi to be log2(N/ni).
;; The TF.IDF score for term i in document j is then defined to be
;; TFij x IDFi. The terms with the highest TF.IDF score are often
;; the terms that best characterize the topic of the document.
@jackrusher
jackrusher / gcloud-tramp.el
Created June 19, 2019 13:58
Tramping into GCloud instances from within emacs
;; make sure you've set your default project with:
;; gcloud config set project <project-name>
(require 'tramp)
(add-to-list 'tramp-methods
'("gcssh"
(tramp-login-program "gcloud compute ssh")
(tramp-login-args (("%h")))
(tramp-async-args (("-q")))
(tramp-remote-shell "/bin/sh")
//
// http://raganwald.com/2019/01/14/structural-sharing-and-copy-on-write.html
// http://raganwald.com/2019/01/26/reduce-reuse-recycle.html
//
const SliceHandler = {
has (slice, property) {
if (property in slice) {
return true;
}
@romainl
romainl / breakhere.vim
Created May 26, 2017 09:13
Universal opposite of J
function! BreakHere()
s/^\(\s*\)\(.\{-}\)\(\s*\)\(\%#\)\(\s*\)\(.*\)/\1\2\r\1\4\6
call histdel("/", -1)
endfunction
nnoremap <key> :<C-u>call BreakHere()<CR>
@saoudrizwan
saoudrizwan / TouchUpInsideViews.swift
Last active October 29, 2023 14:16
Using a long press gesture recognizer, you can recreate a 'touch up inside' button effect on any view.
let longPress = UILongPressGestureRecognizer(target: self, action: #selector(upgradeAlertViewOtherUpgradesLongPressHandler))
longPress.minimumPressDuration = 0
var longPressGRStartPoint: CGPoint?
var didCancelLongPressGR = false
func viewTouched(sender: UILongPressGestureRecognizer) {
let currentPoint = sender.location(in: self.view)
switch sender.state {
case .began:
@ljharb
ljharb / array_iteration_thoughts.md
Last active September 6, 2024 04:53
Array iteration methods summarized

Array Iteration

https://gist.github.com/ljharb/58faf1cfcb4e6808f74aae4ef7944cff

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 mu

@agumonkey
agumonkey / cl-history.txt
Created August 18, 2016 18:52 — forked from danlentz/cl-history.txt
Detailed account and personal insights on the history of common-lisp
From welch@thor.oar.net Thu Oct 20 16:53:41 EDT 1994
Article: 15160 of comp.lang.lisp
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!news.mathworks.com!usenet.eel.ufl.edu!usenet.cis.ufl.edu!caen!math.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!ns.mcs.kent.edu!kira.cc.uakron.edu!malgudi.oar.net!malgudi.oar.net!welch
From: welch@thor.oar.net (Arun Welch)
Newsgroups: comp.lang.lisp
Subject: CL History (was Re: Why do people like C?)
Date: 20 Oct 94 15:34:10
Organization: OARnet
Lines: 3244
Message-ID: <WELCH.94Oct20153410@thor.oar.net>