Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Andrey M amka

🏠
Working from home
View GitHub Profile
@amka
amka / markdown.plist
Created Jul 10, 2018
Markdown file associations
View markdown.plist
<dict>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>text/x-markdown</string>
</array>
<key>CFBundleTypeExtensions</key>
<array>
@amka
amka / Info.plist
Created Jul 10, 2018
File associations
View Info.plist
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>XML File</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSItemContentTypes</key>
@amka
amka / LinesCount.java
Last active Nov 28, 2016
Simple app to count lines in file in different language.
View LinesCount.java
package me.meamka;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.text.DecimalFormat;
import java.text.NumberFormat;
public class LinesCount {
View limited_chunk_generator.py
def get_chunk(sequence, chunk_size=100, limit=None):
count = 0
offset = 0
length = len(sequence)
if not limit:
limit = length
while count < limit and offset < length:
View new File.js
function getFileObject (fileObject, callback) {
var blob = null;
var xhr = new XMLHttpRequest();
xhr.open("GET", fileObject.path);
xhr.responseType = "blob";
// Process onload event: create new File object and call callback function.
xhr.onload = () => {
blob = xhr.response;
blob.name = fileObject.name;
View iter.py
def process_chunk(*items):
pass
def process_count(count):
print 'Count %d' % count
def chunked(iters, size):
@amka
amka / named tuple.py
Created Apr 1, 2016
Hackerrank namedtuple challenge
View named tuple.py
from collections import namedtuple
n = input()
Mark = namedtuple('Mark', raw_input().strip())
print round(sum([float(m.MARKS) for m in [Mark(*map(lambda x: x.strip(), raw_input().strip().split())) for i in xrange(n)]]) / n, 2)
View waterfill.py
class Solution(object):
def trap(self, height):
"""
:type height: List[int]
:rtype: int
"""
water = 0
height_len = len(height)
if height_len < 3:
return water
@amka
amka / NSSplitView Delegate.mm
Last active Dec 22, 2015
NSSplitView Delegate
View NSSplitView Delegate.mm
#define kSnapToDelta 8.0
#define kMinSourceListWidth 150.0
#define kSnapSourceListWidth 250.0
#define kMinContentWidth 150.0
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark - NSSplitView Delegate
- (void) splitView:(NSSplitView*) splitView resizeSubviewsWithOldSize:(NSSize) oldSize
{
if (splitView == _splitView)
View glass.mm
//
// CustomView.m
// MaskTest
//
// Created by Sean Christmann on 12/22/08.
// Copyright 2008 EffectiveUI. All rights reserved.
//
#import "MagnifierView.h"