This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
func lift<A, B>(_ value: (A?, B?)) -> (A, B)? { | |
return value.0.flatMap { lhs in | |
value.1.flatMap { (lhs, $0) } | |
} | |
} | |
func lift<A, B, C>(_ value: (A?, B?, C?)) -> (A, B, C)? { | |
return value.0.flatMap { lhs in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
----- Esc ----- | |
Quick change directory: Esc + c | |
Quick change directory history: Esc + c and then Esc + h | |
Quick change directory previous entry: Esc + c and then Esc + p | |
Command line history: Esc + h | |
Command line previous command: Esc + p | |
View change: Esc + t (each time you do this shortcut a new directory view will appear) | |
Print current working directory in command line: Esc + a | |
Switch between background command line and MC: Ctrl + o | |
Search/Go to directory in active panel: Esc + s / Ctrl + s then start typing directory name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <objc/runtime.h> | |
#import "SMAGlobal.h" | |
#import "CocoaLumberjack.h" | |
#import "NSObject+SMATimer.h" | |
#import "SMAMacros.h" | |
#import "SMABlockMacros.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var markup = document.documentElement.innerHTML; | |
var htmlEnDeCode = (function() { | |
var charToEntityRegex, | |
entityToCharRegex, | |
charToEntity, | |
entityToChar; | |
function resetCharacterEntities() { | |
charToEntity = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct SwimmingWorkout { | |
var distance: Double | |
var time: Double | |
var stroke: Stroke | |
static var breaststrokeWorkouts: [SwimmingWorkout] = [] | |
static var freestyleWorkouts: [SwimmingWorkout] = [] | |
static var butterflyWorkouts: [SwimmingWorkout] = [] | |
static var backstrokeWorkouts: [SwimmingWorkout] = [] | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def comb(array, k): | |
""" | |
Get all combinations of k elements from array | |
Arguments: | |
array -- an array of elements, source for combinations | |
k -- number of elements in combination | |
Return: | |
comb -- array of stored combinations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Created by Ievgen Gavrysh on 7/30/18. | |
// http://github.com/igavrysh | |
// | |
// This gist is created to show down-to-basics way of handling | |
// Swift optionals. | |
// | |
// No syntax sugar is used and only common and basic Swift language structures | |
// are applied. That includes but not limited to generics and high order functions. | |
// I believe that starting learning Swift Optionals from this sample if far | |
// more correct and easier then with features Apple included into Swift in order to |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import networkx as nx | |
import matplotlib.pyplot as plt | |
def draw_graph(adjList, log = False): | |
V = len(adjList) | |
# extract nodes from graph | |
nodes = set([i for i in range(V)]) | |
if log: print("nodes: " + str(nodes)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Set the default java using the below command. | |
#The above command would list all Java JDK installed on your system, like below. | |
sudo update-alternatives --config java |
OlderNewer