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
//: A SpriteKit based Playground | |
import PlaygroundSupport | |
import SpriteKit | |
let sceneView = SKView(frame: CGRect(x:0 , y:0, width: 640, height: 480)) | |
class GameOverScene : SKScene { | |
var label = SKLabelNode(fontNamed: "Chalkduster") | |
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 <regex> | |
int main(int argc, char const *argv[]) | |
{ | |
const std::string foo = "hello \n sir \n"; | |
std::vector<EventPos> pairs; | |
generateEvents(foo, '\n', pairs); | |
std::printf("%zu\n", pairs.size()); | |
const std::string sample = "remote= bar foo=4 six=bar fhhfghfgdhgdf do=555"; | |
const std::regex sampleRex("([a-zA-Z0-9_]+)\\s*=\\s*([a-zA-Z0-9_]+)"); |
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 <string> | |
#include <filesystem> | |
#include <vector> | |
#include <cstdio> | |
#include <cstdlib> | |
struct EventPos { | |
size_t ind = 0; | |
size_t size = 0; |
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
fn bit_mask_index(mask:u64) -> Option<usize> { | |
match mask { | |
0 => None, | |
1 => Some(0), | |
2 => Some(1), | |
4 => Some(2), | |
8 => Some(3), | |
16 => Some(4), |
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
size_t find_unset_bit(size_t num) { | |
return ~num & (num + 1); | |
} | |
size_t find_first_set_bit(size_t num) { | |
return num & -num; | |
} |
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
use std::collections::HashMap; | |
fn add_rand_strings(keys:&mut Vec<String>, amnt:usize, l:usize) { | |
const CHARSET: &[u8] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; | |
let mut rnd = 548324; | |
for i in 0..amnt { | |
let mut s = String::new(); | |
for j in 0..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
#include <string> | |
#include <cstring> | |
#include <filesystem> | |
#include <string> | |
#include <iostream> | |
#include <regex> | |
#include <vector> | |
#include <unordered_map> | |
#include <cstdio> | |
#include <cstdlib> |
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 <map> | |
#include <unordered_map> | |
#include <string> | |
#include <vector> | |
#include <cstdio> | |
#include <cstring> | |
#include <cstdlib> | |
#include <cstdint> | |
#include <ctime> | |
#include <optional> |
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
int main(int argc, char const *argv[]) | |
{ | |
std::unordered_map<std::string, std::string> fooMap; | |
const std::string s1 = "foobar"; | |
const std::string s2 = "doobar"; | |
const std::string s3 = "loobar"; | |
const std::string s4 = "4oobar"; | |
const std::string s5 = "77oobar"; | |
std::printf("Bucket count is %zu\n", fooMap.bucket_count()); |
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 <map> | |
#include <string> | |
#include <vector> | |
#include <cstdio> | |
#include <cstdlib> | |
#include <cstdint> | |
#include <ctime> | |
#include <optional> | |
#include <chrono> | |
#include <memory> |
NewerOlder