Skip to content

Instantly share code, notes, and snippets.

View lgmkr's full-sized avatar
🏠
Working from home

Oleh Makarov lgmkr

🏠
Working from home
View GitHub Profile
@lgmkr
lgmkr / ts-basic-types.ts
Last active April 23, 2020 15:12
ts-in-nodejs
// primitive types
let isOk: boolean = true;
let greeting: string = "Hello";
let count: number = 5;
let fruits: string[] = ["banana", "apple"]; // Array<string>
let tuple: [string, number] = ["hi", 10]; // tuple[3] = 1 <- error
enum Fruits {
banana = "BANANA",
apple = "APPLE",
npm install --save-dev @babel/core @babel/preset-env
@lgmkr
lgmkr / index.js
Last active December 6, 2018 20:34
#!/usr/bin/env node
console.log('Hello world!')
@lgmkr
lgmkr / install-mit-schema-for-SICP.md
Created December 30, 2017 11:30 — forked from deepak/install-mit-schema-for-SICP.md
installing MIT-scheme for doing SICP

installing MIT Schema

The SICP page recommends MIT scheme,
so that is what we will use

to install it, on Apple OSX using Homebrew:

  brew tap x11
  brew cask install xquartz
var f = x => x * 10
f(100) //=> 1000
var f = x => console.log(x * 10)
f(100) //=> 1000
(x => console.log(x * 10))(10) //=> 100
(10)(x => console.log(x*10)) // Error
0x594A1057366D4Db941f90F0D8311e50CB64a9979
@lgmkr
lgmkr / count_words.py
Last active November 3, 2016 19:52
How to analyse text and count word frequencies in python
import re
import string
frequency = {}
document_text = open('test.txt', 'r')
text_string = document_text.read().lower()
match_pattern = re.findall(r'\b[a-z]{3,15}\b', text_string)
for word in match_pattern:
count = frequency.get(word,0)
require 'rails_helper'
RSpec.describe TodosController, :type => :controller do
context "GET index" do
#context "POST create" do
#context "GET show" do
#context "PATCH update" do (or PUT update)
#context "DELETE destroy" do
#context "GET new" do
set-window-option -g xterm-keys on
set-window-option -g mode-keys vi
# bind for use vim-like copy/paste in scroll mode
bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'y' copy-selection
# bind for reload config
bind r source-file ~/.tmux.conf \; display-message "Config reloaded."

Figure out a good standard for how to use the HTTP response codes in a 'truly RESTful' (Now called 'Hypermedia API' apparently) way.

Summary