Skip to content

Instantly share code, notes, and snippets.

View mtavkhelidze's full-sized avatar
🇬🇪
OOP is an exceptionally bad idea which could only have originated in California.

Misha Tavkhelidze mtavkhelidze

🇬🇪
OOP is an exceptionally bad idea which could only have originated in California.
View GitHub Profile
@mtavkhelidze
mtavkhelidze / example.m
Last active August 27, 2016 09:48 — forked from jakepetroules/example.m
Drawing animated focus rings in Cocoa
#import <dlfcn.h>
static off_t lookupPrivateSymbol(const char *path, const char *symbol)
{
// TODO: Parse the Mach-O file
NSTask *task = [[NSTask alloc] init];
task.launchPath = @"/usr/bin/nm";
task.arguments = @[@"-a", @(path)];
NSPipe *outputPipe = [NSPipe pipe];
task.standardOutput = outputPipe;
@mtavkhelidze
mtavkhelidze / pmga.js
Last active September 4, 2016 12:29
Poor man's Google Analytics with webtask.io
/*eslint no-console: 0*/
/**
Poor man's Google Analytics webtask.io Task.
Written by Misha Tavkhelidze
*/
'use strict';
var mongo = require('mongodb').MongoClient;
/**
* mocha_runner.js — Simple Mocha Runner for ES6
*
* Test your ES6 code with Mocha
*
* In package.json: "test": "babel-node run_mocha.js"
*
* Written by Misha Tavkhelidze <[email protected]>
*
* Copyright (c) 2016 Misha Tavkhelidze
# Generic Makefile with deps for C++
CXX = g++
CXXFLAGS = -std=c++14 -Wall -Wextra -Werror -pedantic-errors \
-Wno-unused-const-variable -Wno-missing-braces \
-Wfatal-errors -MMD -O0 -g
SRC = $(wildcard *.cpp)
BIN = $(patsubst %.cpp,%.bin,$(SRC))
OBJ = $(SRC:.cpp=.o)
@mtavkhelidze
mtavkhelidze / remove_android_studio.sh
Last active October 25, 2017 06:40 — forked from tahmidsadik/purgeAndroid.txt
How to completely remove Android Studio from Mac OS X
#!/usr/bin/env bash
# Remove Android Studio from your macOs
dry_run=true
while getopts "f" opt; do
case $opt in
f)
dry_run=false
@mtavkhelidze
mtavkhelidze / curry.js
Created March 31, 2018 12:12
Curry any JavaScript function as many times as you like.
Function.prototype.curry = function () {
const slice = Array.prototype.slice;
const args = slice.apply(arguments);
const that = this;
return function () {
return that.apply(null, args.concat(slice.apply(arguments)));
};
};
const fn = (x1, x2, x3) => {
@mtavkhelidze
mtavkhelidze / unmp
Created June 4, 2018 08:12
Update local or global npm packages
#!/usr/bin/env bash
function usage() {
echo "Usage: $(basename $0) -l/-u [-g -h]" 1>&2
echo "Options are:" 1>&2
echo " -l list packages" 1>&2
echo " -u update packages" 1>&2
echo " -g go global" 1>&2
echo " -h show this help" 1>&2
exit 1

Keybase proof

I hereby claim:

  • I am mtavkhelidze on github.
  • I am mtavkhelidze (https://keybase.io/mtavkhelidze) on keybase.
  • I have a public key ASAnwKsslY4uA6pNahXu0wZsr_kIhXEhY0es1CW357irrwo

To claim this, I am signing this object:

@mtavkhelidze
mtavkhelidze / OrderedSet.js
Last active July 8, 2018 13:26
Ordered set data structure in JavaScript from Functional Program Design in Scala course by Martin Odersky.
function NonEmpty(elem, left, right) {
const contains = (x) => {
if (x < elem)
return left.contains(x);
else if (x > elem)
return right.contains(x);
else if (x === elem)
return true;
else
@mtavkhelidze
mtavkhelidze / repeat-until.scala
Created July 8, 2018 17:23
Mimicking loops in Scala
import scala.language.reflectiveCalls
def repeat(command: => Unit) = new {
def until(condition: => Boolean): Unit =
if (condition) {
command
until(condition)
} else ()
}