This file contains hidden or 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
class DynamicSpacerHeightLayoutManager<ID: Equatable & Hashable>: ObservableObject { | |
struct Element { | |
let offset: CGFloat | |
let height: CGFloat | |
} | |
@Published private var orderedByOffset = OrderedDictionary<ID, Element>() | |
// insert: O(n) <- can be optimized further | |
// append: O(1) | |
// update offset: O(n) <- can be optimized furhter |
This file contains hidden or 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 SwiftUI | |
struct ContentView: View { | |
var body: some View { | |
NativeEditor() | |
.frame(maxWidth: 400, maxHeight: 600) | |
} | |
} | |
struct NativeEditor: NSViewRepresentable { |
This file contains hidden or 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 I = simp(f, a, b, n) | |
I = 0; | |
dx = (b-a) / n; | |
for i = 1:2:n | |
xi = a + (i - 1) * dx; | |
xi_1 = a + (i * dx); | |
xi_2 = a + (i + 1) * dx; | |
I = I + (1/3) * (f(xi) + 4 * f(xi_1) + f(xi_2)) * dx; | |
end |
This file contains hidden or 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
class LeftAlignedCollectionViewLayout: UICollectionViewFlowLayout { | |
override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? { | |
let attributes = super.layoutAttributesForElements(in: rect) | |
var leftMargin = sectionInset.left | |
var maxY: CGFloat = -1.0 | |
attributes?.forEach { layoutAttribute in | |
guard layoutAttribute.representedElementCategory == .cell else { return } | |
if layoutAttribute.frame.origin.y >= maxY { |
This file contains hidden or 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
extension Dictionary where Value: Hashable { | |
/// Groups keys with common values together. Example: | |
/// ``` | |
/// let groceryList = ["Apple": 2, "Oranges": 3, "Pears": 2] | |
/// groceryList.keysGroupedByValue | |
/// // => [2: ["Apple", "Pears"], 3: ["Oranges"]] | |
/// ``` | |
public var keysGroupedByValue: [Value: [Key]] { | |
var commonalities: [Value: [Key]] = [:] | |
for (key, value) in self { |
This file contains hidden or 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
# Output color | |
export CLICOLOR=1 | |
export LSCOLORS=dxfxcxdxbxegedabagacad | |
# Prompt Color | |
PS1='\[\e[0;32m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\] \[\e[1;32m\]\$\[\e[m\] \[\e[1;37m\]' | |
alias atom="open -a atom.app" | |
alias grm='git checkout master && git pull origin master && git checkout - && git rebase master' |
This file contains hidden or 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<!-- Other --> | |
<meta charset="utf-8"> | |
<meta name="description" content="This is an example of a meta description. This will often show up in search results."> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<link rel="stylesheet" href="main.css"> | |
</head> | |
<body> |
This file contains hidden or 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
mr | Marathi | |
---|---|---|
bs | Bosnian | |
ee_TG | Ewe (Togo) | |
ms | Malay | |
kam_KE | Kamba (Kenya) | |
mt | Maltese | |
ha | Hausa | |
es_HN | Spanish (Honduras) | |
ml_IN | Malayalam (India) | |
ro_MD | Romanian (Moldova) |
This file contains hidden or 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
Hex format: | |
['#f44336', '#E91E63', '#9C27B0', '#673AB7', '#3F51B5', '#2196F3', '#03A9F4', '#00BCD4', '#009688', '#4CAF50', '#8BC34A', '#CDDC39', '#FFEB3B', '#FFC107', '#FF9800', '#FF5722', '#795548', '#9E9E9E', '#607D8B', '#ffebee', '#FCE4EC', '#F3E5F5', '#EDE7F6', '#E8EAF6', '#E3F2FD', '#E1F5FE', '#E0F7FA', '#E0F2F1', '#E8F5E9', '#F1F8E9', '#F9FBE7', '#FFFDE7', '#FFF8E1', '#FFF3E0', '#FBE9E7', '#EFEBE9', '#FAFAFA', '#ECEFF1', '#ffcdd2', '#F8BBD0', '#E1BEE7', '#D1C4E9', '#C5CAE9', '#BBDEFB', '#B3E5FC', '#B2EBF2', '#B2DFDB', '#C8E6C9', '#DCEDC8', '#F0F4C3', '#FFF9C4', '#FFECB3', '#FFE0B2', '#FFCCBC', '#D7CCC8', '#F5F5F5', '#CFD8DC', '#ef9a9a', '#F48FB1', '#CE93D8', '#B39DDB', '#9FA8DA', '#90CAF9', '#81D4FA', '#80DEEA', '#80CBC4', '#A5D6A7', '#C5E1A5', '#E6EE9C', '#FFF59D', '#FFE082', '#FFCC80', '#FFAB91', '#BCAAA4', '#EEEEEE', '#B0BEC5', '#e57373', '#F06292', '#BA68C8', '#9575CD', '#7986CB', '#64B5F6', '#4FC3F7', '#4DD0E1', '#4DB6AC', '#81C784', '#AED581', '#DCE775', '#FFF176', '#FFD54F', '#FFB74D', '#FF8A65', |
This file contains hidden or 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 os | |
# Writes all files that end with a certain extentsion to a .txt file | |
# Works in both Python 2 and Python 3 | |
extension = ".png" | |
fileList = os.listdir('Outflow-Icons') | |
for fichier in fileList[:]: # filelist[:] makes a copy of filelist. | |
if not(fichier.endswith(extension)): | |
fileList.remove(fichier) |
NewerOlder