Skip to content

Instantly share code, notes, and snippets.

Avatar
🌉
SF, hacking, thinking, observing, feeling

Anton Podviaznikov podviaznikov

🌉
SF, hacking, thinking, observing, feeling
View GitHub Profile
View NSAttributedStringHighlight.swift
extension NSAttributedString {
func highlighting(_ substring: String, using color: UIColor) -> NSAttributedString {
let attributedString = NSMutableAttributedString(attributedString: self)
attributedString.addAttribute(.foregroundColor, value: color, range: (self.string as NSString).range(of: substring))
return attributedString
}
}
// Usage:
@unnamedd
unnamedd / MyService.swift
Created Aug 8, 2019 — forked from mminer/MyService.swift
Components of XPC service.
View MyService.swift
import Foundation
class MyService: NSObject, MyServiceProtocol {
func upperCaseString(_ string: String, withReply reply: @escaping (String) -> Void) {
let response = string.uppercased()
reply(response)
}
}
@unnamedd
unnamedd / MacEditorTextView.swift
Last active Aug 9, 2020
[SwiftUI] MacEditorTextView - A simple and small NSTextView wrapped by SwiftUI.
View MacEditorTextView.swift
/**
* MacEditorTextView
* Copyright (c) Thiago Holanda 2020
* https://twitter.com/tholanda
*
* MIT license
*/
import Combine
import SwiftUI
@mfikes
mfikes / README.md
Last active Apr 7, 2019
eval in ClojureScript
View README.md

ClojureScript master now has cljs.core/eval. This delegates to cljs.core/*eval* which, by default throws, but you can bind it to any implementation that can compile and evaluate ClojureScript forms.

If you require the cljs.js namespace (which is the main support namespace for self-hosted ClojureScript), then cljs.core/*eval* is set to an implementation that uses self-hosted ClojureScript for this capability. This means that all self-hosted ClojureScript environments will now have a first-class eval implementation that just works. For example, Planck master:

$ planck -q
cljs.user=> (eval '(+ 2 3))
5
@enricofoltran
enricofoltran / main.go
Last active Jul 20, 2020
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
View main.go
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
View A.synopsis.md

Synopsis

Problem: Omegawiki's database layout ( http://www.omegawiki.org/Help:OmegaWiki_database_layout ) is incredibly complex and makes it tough to query the db.

This quick'n'dirty script imports the data into datomic. It aims to fully connect them with refs so that you can walk along the entities just like clojure maps.

Once in Datomic the entire db is in memory and it's very easy to explore the db and also very fast.

@philips
philips / users.md
Last active Jul 3, 2020
Kubernetes Third-Party Resource Users
View users.md
@ianstormtaylor
ianstormtaylor / slate-node-portal.js
Created Sep 13, 2016
A React component example that makes it simple to position an element relative to a Slate node.
View slate-node-portal.js
import React from 'react'
import Portal from 'react-portal'
import getOffsets from 'positions'
import { findDOMNode } from 'slate'
/**
* No-op.
*
* @type {Function}
@leonardofed
leonardofed / README.md
Last active Aug 14, 2020
A curated list of AWS resources to prepare for the AWS Certifications
View README.md


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.


@nnja
nnja / nina.zsh-theme
Last active Feb 23, 2017
My zshell prompt theme, a bastardization of robbyrussel & kolo themes
View nina.zsh-theme
autoload -Uz vcs_info
zstyle ':vcs_info:*' stagedstr '%F{green}●'
zstyle ':vcs_info:*' unstagedstr '%F{yellow}●'
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{11}%r'
zstyle ':vcs_info:*' enable git svn
theme_precmd () {
if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]] {
zstyle ':vcs_info:*' formats '%c%u%B%F{green} '
You can’t perform that action at this time.