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
// | |
// Weak.swift | |
// DDScanner | |
// | |
// Created by Sergey Minakov on 12.05.16. | |
// Copyright © 2016 Code Monkeys. All rights reserved. | |
// | |
import UIKit |
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
public extension SequenceType { | |
/// Categorises elements of self into a dictionary, with the keys given by keyFunc | |
func categorise<U : Hashable>(@noescape keyFunc: Generator.Element -> U) -> [U:[Generator.Element]] { | |
var dict: [U:[Generator.Element]] = [:] | |
for el in self { | |
let key = keyFunc(el) | |
if case nil = dict[key]?.append(el) { dict[key] = [el] } | |
} |
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 | |
//MARK: GCD Extensions | |
typealias Queue = dispatch_queue_t | |
enum QueueType { | |
case Main | |
case Low, Normal, High, Background |
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
# coding=utf-8 | |
import sys | |
import os | |
from datetime import datetime, date, time | |
def main(arguments): | |
if len(arguments) == 0: return | |
name = arguments[0][:1].upper() + arguments[0][1:] | |
createDirectory = False |
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
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
export PS1="[\t] \[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\[\033[31m\]\$(parse_git_branch)\[\033[00m\]$ " | |
export CLICOLOR=1 | |
export LSCOLORS=ExFxBxDxCxegedabagacad | |
alias ls='ls -GFh' | |
export LC_COLLATE=ru_RU.UTF-8 |
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
# OS X | |
.DS_Store | |
# Xcode | |
build/ | |
*.pbxuser | |
!default.pbxuser | |
*.mode1v3 |
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
Darwin implementation | |
======= | |
I. Default keys for NSCache (current NSCache behavior. If not Darwin -> should match Darwin's) | |
======= | |
using NSCache with SwiftNoHash | |
default NSCache values: '.totalCostLimit' = 0, '.countLimit' = 0 | |
set value 'a' for key <swift.noHash.10> (0) | |
set value 'b' for key <swift.noHash.10> (1) | |
Stored value for key (0): <swift.noHash.10> = a | |
Stored value for key (1): <swift.noHash.10> = b |
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 | |
extension UnicodeScalar { | |
var isSpace: Bool { | |
return isspace(Int32(self.value)) != 0 | |
} | |
var isAlphanumeric: Bool { | |
return isalnum(Int32(self.value)) != 0 |
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
function webRequest(url, data, callback, target) { | |
var http = new XMLHttpRequest(); | |
if(!data){ mode="GET"; } else { mode="POST"; } | |
http.open(mode, url, true); | |
if(mode=="POST"){ http.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); } | |
http.onreadystatechange = function(){ if(http.readyState==4){ callback(http.responseText,target); }}; | |
http.send(data); | |
} | |
//http://stackoverflow.com/questions/247483/http-get-request-in-javascript |
OlderNewer