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
#!/bin/bash | |
git clone --depth 1 --branch release/14.x https://github.com/llvm/llvm-project | |
cd llvm-project | |
mkdir build | |
cd build | |
echo "Configuring clang" | |
cmake -G "Ninja" -DENABLE_SHARED=OFF -DLIBCLANG_BUILD_STATIC=ON -DLLVM_ENABLE_PROJECTS="clang" -DCMAKE_BUILD_TYPE=Release ../llvm |
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 magnus::{error::Error, exception, gc, value::Value, RTypedData, TryConvert, TypedData}; | |
use std::{marker::PhantomData, ops::Deref}; | |
/// A small wrapper for `RTypedData` that keeps track of the concrete struct | |
/// type, and the underlying [`Value`] for GC purposes. | |
#[derive(Debug)] | |
#[repr(transparent)] | |
pub struct WrappedStruct<T: TypedData> { | |
inner: RTypedData, | |
phantom: PhantomData<T>, |
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
# How would I write a sig such that #wrapped_start the same type signature | |
# as the subclass' #start method (i.e. Car#start or Boat#start) | |
class Vehicle | |
def wrapped_start | |
start | |
end | |
end | |
class Car < Vehicle | |
sig { params(key: String, license: License).returns(T::Boolean) } |
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
user nginx; | |
worker_processes 10; | |
worker_rlimit_nofile 16384; | |
pid /var/run/nginx.pid; | |
error_log /var/log/nginx/error.log warn; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' |
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
{ | |
"id": 820982911946154500, | |
"email": "jon@doe.ca", | |
"closed_at": null, | |
"created_at": "2019-07-30T12:29:54-04:00", | |
"updated_at": "2019-07-30T12:29:54-04:00", | |
"number": 234, | |
"note": null, | |
"token": "123456abcd", | |
"gateway": 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
class BlogPostCreator | |
def create_post | |
if similar_post_already_created? | |
yield_to_user("This looks like a duplicate, sure you want to post this?") || halt | |
end | |
# do the things... | |
end | |
end |
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
def sum_price(items: Enumerable<RespondTo[price: Integer]> | |
# ... | |
end |
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
export class UserList extends React.Component { | |
handleClick = (item) => console.log('You clicked ', this.props.group); | |
render() { | |
return ( | |
<HugeListOfItems | |
group={group} | |
handleClick={this.handleClick} | |
/> | |
); |
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
// Overly complicated search form which uses custom state management 👎 | |
function SearchBox() { | |
const [queryParams, setQueryParams] = useState({ showAllResults: false }); | |
const handleSearchChange = (ev) => { | |
const eventValue = ev.target.value; | |
setQueryParams({ ...queryParams, q: eventValue }); | |
} | |
NewerOlder