This file contains 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
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"name": "(gdb) Launch", | |
"type": "cppdbg", | |
"request": "launch", | |
"program": "${workspaceFolder}/a.out", | |
"args": [], | |
"stopAtEntry": false, |
This file contains 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 the post oembed does NOT have a "url_expires_at" field: | |
it's not a pnut file, it's safe to use the "url" field from the post oembed | |
else: | |
if "url_expires_at" is NOT past: | |
it's safe to use "url" field from the post oembed |
This file contains 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 Cocoa | |
extension String { | |
// https://stackoverflow.com/a/36258684/2227743 | |
var containsEmoji: Bool { | |
for scalar in self.unicodeScalars { | |
switch scalar.value { | |
case 0x1F600...0x1F64F, // Emoticons | |
0x1F300...0x1F5FF, // Misc Symbols and Pictographs |
This file contains 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
# Thanks https://gist.github.com/Tokuriku/f7d6ce5a68d2154c28b0#gistcomment-1781457 | |
find . -path ./Pods -prune -o -name "*.swift" -print0 ! -name "/Pods" | xargs -0 wc -l |
This file contains 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 let imageSource = CGImageSourceCreateWithURL(fileURL as CFURL, nil) { | |
let imageProperties = CGImageSourceCopyPropertiesAtIndex(imageSource, 0, nil) | |
if let dict = imageProperties as? [String: Any] { | |
print(dict) | |
} | |
} |
This file contains 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
#include <iostream> | |
#include <iomanip> | |
#include <random> | |
// this template comes from http://stackoverflow.com/a/39183450/2227743 | |
template<class Ty = double, class = std::enable_if<std::is_floating_point<Ty>::value>> | |
class random_probability_generator { | |
public: | |
// default constructor uses single random_device for seeding | |
random_probability_generator() |
This file contains 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
/** | |
* HTTPDownloader.hpp | |
* | |
* A simple C++ wrapper for the libcurl easy API. | |
* | |
* Written by Uli Köhler (techoverflow.net) | |
* Published under CC0 1.0 Universal (public domain) | |
*/ | |
#ifndef HTTPDOWNLOADER_HPP | |
#define HTTPDOWNLOADER_HPP |
This file contains 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
#include <iostream> | |
#include <string> | |
#include <sstream> | |
using namespace std; | |
int get_int() | |
{ | |
string input; | |
int num; | |
getline(cin, input); |
This file contains 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
URLQueryAllowedCharacterSet | |
!$&'()*+,-./0123456789:;=?@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~ | |
URLHostAllowedCharacterSet | |
!$&'()*+,-.0123456789:;=ABCDEFGHIJKLMNOPQRSTUVWXYZ[]_abcdefghijklmnopqrstuvwxyz~ | |
URLPathAllowedCharacterSet |
This file contains 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
let names = ["h8", "h9", "h10", "h11", "h4", "h12", "h5", "h6"] | |
let result = names.sort { $0.compare($1, options: .NumericSearch) == .OrderedAscending } | |
result // ["h4", "h5", "h6", "h8", "h9", "h10", "h11", "h12"] |
NewerOlder