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
| /// Given two sequences and a function, return a sequence of results of applying | |
| /// the function to sucessive elements of the sequences. | |
| /// | |
| /// Like Haskell's zipWith. | |
| func zipCombine<S1: SequenceType, S2: SequenceType, T>( | |
| sequence1: S1, | |
| _ sequence2: S2, | |
| combine: (S1.Generator.Element, S2.Generator.Element) -> T | |
| ) -> AnySequence<T> { | |
| return AnySequence { () -> AnyGenerator<T> in |
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 SequenceType { | |
| /// Return a lazy sequence of elements of this sequence that are of type T | |
| func asLazySequence<T>() -> LazyMapSequence<LazyFilterSequence<Self>, T> { | |
| return self.lazy.filter{ $0 is T }.map{ $0 as! T } | |
| } | |
| /// Return a lazy sequence of the elements that are NSDictionary instances | |
| func asLazyNSDictionarySequence() |
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
| src="$SRCROOT/myproject/input.json" | |
| dst_hpp="$SRCROOT/myproject/output.hpp" | |
| dst_cpp="$SRCROOT/myproject/output.cpp" | |
| if [ "$src" -nt "$dst_hpp" ] || [ "$src" -nt "$dst_cpp" ]; then | |
| echo "Generating $dst_hpp and $dst_cpp..." | |
| "$BUILT_PRODUCTS_DIR/codegenerator" "$src" "$dst_hpp" "$dst_cpp" | |
| else | |
| echo "$dst_hpp and $dst_cpp are up to date." | |
| fi |
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
| #!/bin/bash | |
| set -e | |
| echo 'Updating homebrew...' | |
| brew update && brew upgrade && brew cleanup | |
| echo 'Updating npm...' | |
| npm update -g |
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
| auto now = std::chrono::system_clock::now(); | |
| auto now_c = std::chrono::system_clock::to_time_t(now); | |
| std::cout << std::put_time(std::localtime(&now_c), "%F %T") << '\n'; |
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 | |
| func logDebug(message: String, | |
| function: String = __FUNCTION__, file: String = __FILE__, line: Int = __LINE__) | |
| { | |
| #if DEBUG | |
| let filename = (file as NSString).lastPathComponent | |
| let msg = "DEBUG: \(message) [\(function) \(filename):\(line)]" | |
| NSLog("%@", msg); | |
| #endif |
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
| on idle | |
| tell application "System Events" | |
| set vpn_name to "'My VPN'" | |
| set rc to do shell script "scutil --nc status " & vpn_name | |
| if rc does not start with "Connected" then | |
| do shell script "scutil --nc start " & vpn_name | |
| end if | |
| end tell | |
| return 120 | |
| end idle |
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
| /* | |
| Copyright (c) 2015 Kristopher Johnson | |
| Permission is hereby granted, free of charge, to any person obtaining | |
| a copy of this software and associated documentation files (the | |
| "Software"), to deal in the Software without restriction, including | |
| without limitation the rights to use, copy, modify, merge, publish, | |
| distribute, sublicense, and/or sell copies of the Software, and to | |
| permit persons to whom the Software is furnished to do so, subject to | |
| the following conditions: |
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
| /* | |
| Copyright (c) 2015 Kristopher Johnson | |
| Permission is hereby granted, free of charge, to any person obtaining | |
| a copy of this software and associated documentation files (the | |
| "Software"), to deal in the Software without restriction, including | |
| without limitation the rights to use, copy, modify, merge, publish, | |
| distribute, sublicense, and/or sell copies of the Software, and to | |
| permit persons to whom the Software is furnished to do so, subject to | |
| the following conditions: |
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
| CXXFLAGS=-I/usr/local/include --std=c++11 | |
| LDFLAGS=-L/usr/local/lib -lreadline | |
| rltest: rltest.cpp | |
| clean: | |
| - /bin/rm rltest | |