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
module abc; | |
import raylib; | |
import std::io; | |
const NUM_MODELS = 9; | |
fn void main() | |
{ | |
// Initialization | |
//-------------------------------------------------------------------------------------- |
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 std::io; | |
import std::collections::list; | |
define DoubleList = List<double>; | |
fn double test_list_on_heap(int len) | |
{ | |
DoubleList list; // By default will allocate on the heap | |
defer list.free(); // Free at end | |
for (int i = 0; i < len; i++) |
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 <time.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdint.h> | |
#include <pthread.h> | |
#include <stdbool.h> | |
static bool is_prime(int n) { | |
int i = 5; |
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
Homebrew build logs for php on macOS 12 | |
Build date: 2022-10-03 12:51:36 |
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
// Copyright (c) 2020 Christoffer Lerno. All rights reserved. | |
// Use of this source code is governed by a LGPLv3.0 | |
// a copy of which can be found in the LICENSE file. | |
#include "vmem.h" | |
#include "common.h" | |
#if defined( _WIN32 ) || defined( __WIN32__ ) || defined( _WIN64 ) | |
#define PLATFORM_WINDOWS 1 | |
#define PLATFORM_POSIX 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
// Switch | |
macro char * @foo(&x) { | |
$switch (@typeof(x)) { | |
$case int: return "int"; | |
$case float: return "float"; | |
$default: return "???"; | |
} | |
} | |
char *x = @foo(10); // char *x = "int"; |
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
// 1. Macros with arguments | |
macro @foo(int &v) { | |
v++; | |
if (v > 10) return 10; | |
return v; | |
} | |
int bar() { | |
int a = 10; | |
@foo(a); |
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
// Assume we also have the following: | |
void doSomethingWithFoo(@NotNull foo) { ... } | |
void doSomethingNull() { ... } | |
void doSomethingMore() { ... } | |
void doSomething(@Nullable Foo foo) | |
{ | |
// doSomethingWithFoo(foo); <- this would have been an error in the IDE | |
// Since foo is @Nullable at this point | |
if (foo == null) |
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
// Synchronous | |
@implementation A | |
{ | |
B *b; | |
} | |
- (void)doSomething { | |
/* ... */ | |
BOOL x = [b performOne]; | |
if (x) [b performTwo]; |
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
//C | |
unsigned char result[CC_MD5_DIGEST_LENGTH]; | |
const char *cString = [self UTF8String]; | |
CC_MD5(cString, (CC_LONG)strlen(cString), result); | |
return bytesToHexString(result, CC_MD5_DIGEST_LENGTH); | |
//Swift | |
let digestLength = 16 | |
var result = Array<UInt8>(count: digestLength, repeatedValue: 0) | |
let cString = cStringUsingEncoding(NSUTF8StringEncoding)! |
NewerOlder