Skip to content

Instantly share code, notes, and snippets.

View novacrazy's full-sized avatar
🔥
Set The Universe On Fire

Nova novacrazy

🔥
Set The Universe On Fire
View GitHub Profile
@novacrazy
novacrazy / arcstr.rs
Created September 22, 2021 10:12
Arc String
use std::{
alloc::{self, Layout},
mem::MaybeUninit,
ops::Deref,
ptr::NonNull,
sync::atomic::{self, AtomicUsize, Ordering},
};
// use repr(C) to ensure field order
#[repr(C)]
@novacrazy
novacrazy / pgf.rs
Last active March 14, 2020 09:33
Progressify Sample Sets (based on Progressive Jittering)
use packed_simd::{f32x2, m32x2};
use rand::Rng;
use crate::math::FastVector; // for fast_floor, you can use your own
/// PJ/PGify only works on outputs with a length 4^N
///
/// https://helloacm.com/how-to-check-if-integer-is-power-of-four-cc/
pub fn is_power_of_four(n: u64) -> bool {
@novacrazy
novacrazy / main.cpp
Created August 22, 2016 01:25
Parallel work and tuple spreading
#include <thenable/thenable.hpp>
#include <thenable/experimental.hpp>
#include <iostream>
using namespace std;
using namespace thenable;
using namespace thenable::experimental;
int i = 1;
@novacrazy
novacrazy / main.cpp
Last active August 17, 2016 13:37
Recursive then implementation
#define UV_OVERLOAD_OSTREAM
#define UV_USE_BOOST_LOCKFREE
#include "uv++.hpp"
#include <iostream>
using namespace std;
int main() {
@novacrazy
novacrazy / main.cpp
Last active July 28, 2016 13:11
Async callbacks
#include <iostream>
#include <chrono>
#include <thread>
#define UV_OVERLOAD_OSTREAM
#include "uv++.hpp"
using namespace std;
@novacrazy
novacrazy / example1.jsx
Last active October 25, 2015 01:58
Example
import * as React from 'react';
class MyWidget extends React.Component {
static displayName = 'MyWidget';
static propTypes = {
itemUrl: React.PropTypes.string.isRequired,
name: React.PropTypes.string.isRequired
};
@novacrazy
novacrazy / stacktrace
Created July 9, 2015 18:16
Long stack trace example
ReferenceError: Input is not defined
at AdvancedSearchForm.render (~/example.com/views/user/forms/advanced_search.jsx:50:42)
at ReactCompositeComponentMixin._renderValidatedComponentWithoutOwnerOrContext (~/example.com/node_modules/react/lib/ReactCompositeComponent.js:789:34)
at ReactCompositeComponentMixin._renderValidatedComponent (~/example.com/node_modules/react/lib/ReactCompositeComponent.js:816:14)
at wrapper [as _renderValidatedComponent] (~/example.com/node_modules/react/lib/ReactPerf.js:70:21)
at ReactCompositeComponentMixin.mountComponent (~/example.com/node_modules/react/lib/ReactCompositeComponent.js:237:30)
at wrapper [as mountComponent] (~/example.com/node_modules/react/lib/ReactPerf.js:70:21)
at Object.ReactReconciler.mountComponent (~/example.com/node_modules/react/lib/ReactReconciler.js:38:35)
at ReactDOMComponent.ReactMultiChild.Mixin.mountChildren (~/example.com/node_modules/react/lib/ReactMultiChild.js:192:44)
at ReactDOMComponent.Mixin
@novacrazy
novacrazy / main_page.dot
Last active August 29, 2015 14:12
Example using scriptor Referee transforms to lazily load, update and transform a template.
<p>{{=it.content}}</p>
@novacrazy
novacrazy / tree.php
Created December 17, 2014 23:32
Tree structure thing I wrote a long time ago
<?php
use \Zend\Json\Json;
$zend_prefix = "WhereverZendIs/";
include_once $zend_prefix."Json/Json.php";
class Tree_Exception extends \Exception {}