Skip to content

Instantly share code, notes, and snippets.

View ck3g's full-sized avatar
👨‍💻
Studying

Vitali Tatarintev ck3g

👨‍💻
Studying
View GitHub Profile
var translations: [String: [String:String]] = [
"en": [
"title": "Title English",
"content": "Hello World"
],
"de": [
"title": "Title Deutsch",
"content": "Hallo Welt"
]
@ck3g
ck3g / solutions.md
Last active January 2, 2020 19:07
Installing Ruby gems on macOS
@ck3g
ck3g / gist:98e1ba5568506dbe87fd0eff551e74d6
Created May 7, 2019 08:03
Installing Ruby gems on macOS
Some gems have issues installing on macOS.
There is a list of possible solutions.
### mysql2
https://gist.github.com/fernandoaleman/ee3ac6957c2ba4f7d7d33a251d58b191
```
brew install openssl
@ck3g
ck3g / example.ex
Created February 14, 2019 16:14
How to read from STDIN in Elixir (for HackerRank)
defmodule Solution do
#Enter your code here. Read input from STDIN. Print output to STDOUT
end
array_length = IO.read(:stdio, :line)
array = IO.read(:stdio, :line)
array_length
|> String.trim
|> String.to_integer
@ck3g
ck3g / quotes.json
Last active September 23, 2018 13:56
The list of quotes for Alexa Skill example. More here: http://whatdidilearn.info/2018/09/23/how-to-call-external-apis-from-alexa-skill.html
[
{
"content": "Your time is limited, so don't waste it living someone else's life.",
"author": "Steve Jobs"
},
{
"content": "It does not matter how slowly you go, as long as you do not stop.",
"author": "Confucius"
},
{
@ck3g
ck3g / sort.swift
Created July 30, 2018 12:05
Sort array elements by two values in Swift
struct FilmSeries {
var title: String
var season: Int?
var episode: Int?
}
var series = [
FilmSeries(title: "3-1", season: 3, episode: 1),
FilmSeries(title: "3-2", season: 3, episode: 2),
FilmSeries(title: "3-3", season: 3, episode: 3),
@ck3g
ck3g / captureGroupValuesExample.swift
Last active June 6, 2019 02:45
Example of how to capture group values using Regular expressions in Swift http://whatdidilearn.info/2018/07/29/how-to-capture-regex-group-values-in-swift.html
import UIKit
struct FilmSeries {
var title: String
var season: Int?
var episode: Int?
}
var series = [
FilmSeries(title: "Pilot", season: 1, episode: 1),
people = [{name: 'Alice'}, {name: 'Bob'}, {name: 'Bill'}, {name: 'Alex'}, {name: 'John'}];
people.reduce((obj, person) => {
const firstLetter = person.name[0].toUpperCase();
return {
...obj,
[firstLetter]: [...(obj[firstLetter] || []), person]
}
}, {});
@ck3g
ck3g / tdd-playground.swift
Last active March 26, 2018 07:09
TDD in XCode Playground
// Original article: https://m.pardel.net/tdd-in-xcode-playgrounds-544a95db11e2
import XCTest
struct Todo {
}
class TodoTests: XCTestCase {
override func setUp() {
require 'ostruct'
alternatives = [
OpenStruct.new(name: "A1", weight: 1),
OpenStruct.new(name: "A2", weight: 1),
OpenStruct.new(name: "A3", weight: 1),
OpenStruct.new(name: "A4", weight: 1),
OpenStruct.new(name: "B1", weight: 1),
OpenStruct.new(name: "B2", weight: 1),
OpenStruct.new(name: "B3", weight: 1),