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 | |
import AVKit | |
import CoreImage | |
import CoreImage.CIFilterBuiltins | |
struct ContentView: View { | |
@State private var currentFilter = 0 | |
var filters : [CIFilter?] = [nil, CIFilter.sepiaTone(), CIFilter.pixellate(), CIFilter.comicEffect()] |
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
// | |
// Original implementation: https://stackoverflow.com/a/39177861/638848 | |
// | |
// Re-made by: Leslie Godwin ([email protected]) | |
import 'dart:convert'; | |
/// Parses/splits a command-line String into a List<String> of the individual argument elements. | |
/// Handles whitespace, quotes and back\slash escape. | |
/// |
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
//#! Swift 5 | |
import Foundation | |
import AppKit | |
//////////////////////////////////////////////////////////////////// | |
//: ## Type Definition | |
struct AttrString { | |
let attributedString: NSAttributedString |
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 Foundation | |
/// `StringScanner` is a fast scanner for Strings and String-like objects. | |
/// It's used to extract structured bits from unstructured strings, while | |
/// avoiding making extra copies of string bits until absolutely necessary. | |
/// You can build Scanners over Substrings, allowing you to scan | |
/// parts of strings and use smaller, more specialized scanners to extract bits | |
/// of that String without needing to reuse another scanner. | |
public struct StringScanner<Input: StringProtocol> { | |
let input: Input |
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
#if os(macOS) | |
import Darwin | |
#elseif os(Linux) | |
import Glibc | |
#endif | |
enum BinaryOperator: Character { | |
case plus = "+" | |
case minus = "-" | |
case times = "*" |
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 Foundation | |
extension UnicodeScalar : ForwardIndexType { | |
public func successor() -> UnicodeScalar { | |
return UnicodeScalar(value + 1) | |
} | |
} | |
var operatorHeads: [UnicodeScalar] = Array("=-+!*%<>&|^~?".unicodeScalars) | |
operatorHeads += Array("\u{00A1}" ... "\u{00A7}") |
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
func + <S: SequenceType, E where S.Generator.Element == E> (lhs: S, rhs: S) -> GeneratorOf<E> { | |
var (g, h) = (lhs.generate(), rhs.generate()) | |
return GeneratorOf { | |
g.next() ?? h.next() | |
} | |
} |
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
#!/usr/bin/env ruby | |
# | |
# Mac OS X webarchive is a binary format of a plist file. You can extract the contents manually: | |
# 1. convert the plist file into XML by "plutil -convert xml1 file.webarchive" | |
# 2. parse the resulted XML file by some XML parser | |
# 3. decode "WebResourceData" by Base64.decode64(data) in each key | |
# 4. save the decoded content into a file indicated by "WebResourceData" | |
# Thankfully, the plist library can take care of annoying steps 2 and 3. | |
# | |
# Preparation: |
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('dart:mirrors'); | |
class MyClass { | |
String _test; | |
String get test => _test; | |
set test(String paramVal) => _test = paramVal; | |
void my_method() { | |
} |
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 <Foundation/Foundation.h> | |
@interface NSArray (Globbing) | |
+ (NSArray*) arrayWithFilesMatchingPattern: (NSString*) pattern inDirectory: (NSString*) directory; | |
@end |
NewerOlder