Skip to content

Instantly share code, notes, and snippets.

View selfup's full-sized avatar
💻
doing the most

Regis Boudinot selfup

💻
doing the most
View GitHub Profile
@selfup
selfup / playground.rs
Last active August 17, 2017 06:55 — forked from anonymous/playground.rs
Rust code shared from the playground #1
#[derive(Debug)]
struct User {
first_name: &'static str,
last_name: &'static str,
}
impl User {
fn new(first_name: &'static str, last_name: &'static str) -> User {
User {
first_name: first_name,
// using this instead of scoped vars (regular function)
function saveWorld(largeBucket, smallBucket, result) {
this.largeBucketA = largeBucket;
this.smallBucketA = 0;
this.movesCounter = 0;
while (this.largeBucketA !== result && this.smallBucketA !== result) {
if (this.largeBucketA === largeBucket && this.smallBucketA === 0) {
this.largeBucketA = largeBucket - smallBucket; // 3
import { app } from 'hyperapp'
import { main, nav, section, h1, button, a, p, span } from '@hyperapp/html'
const Route = props => {
const match = props.exact
? location.pathname === props.path
: location.pathname.match(props.path)
return props.render
? match && props.render({ path: props.path })
: match && section(props.view)
class Person extends React.Component {
render () {
const name = this.props.name.length > 8
? this.props.name.substring(0, 5)
: this.props.name;
const age = this.props.age;
const hobbies = this.props.hobbies.map((hobbie) => <li>{hobbie}</li>);
return (
function Demo() {
this.x = 42;
}
Demo.prototype = {
logX: function() {
console.log(this.x);
},
};

Not Verbose

Compiling wasm-gc v0.1.0 (https://github.com/alexcrichton/wasm-gc#6fe4e9de) error: could not exec the linker cc: No such file or directory (os error 2) | = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/home/selfup/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/tmp/cargo-install.lJhVfpgwNN3f/release/deps/wasm_gc-220fb6710333d060.wasm_gc0.rcgu.o" "-o" "/tmp/cargo-install.lJhVfpgwNN3f/release/deps/wasm_gc-220fb6710333d060" "/tmp/cargo-install.lJhVfpgwNN3f/release/deps/wasm_gc-220fb6710333d060.crate.allocator.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-nodefaultlibs" "-L" "/tmp/cargo-install.lJhVfpgwNN3f/release/deps" "-L" "/home/selfup/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/tmp/cargo-install.lJhVfpgwNN3f/release/deps/libenv_logger-00e3003c8ba14f89.rlib" "/tmp/cargo-install.lJhVfpgwNN3f/release/deps/libparity_wasm-353ddb98eb2b052

Tested on Ubuntu 20.04

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.38.0/install.sh | bash \
  && source ~/.bashrc \
  && command -v nvm \
  && nvm install stable \
  && nvm use stable \
  && echo "Script Check - Npm Version: $(npm -v)" \
 &amp;&amp; echo "Script Check - Node Version: $(node -v)"
@selfup
selfup / fast_diff.rb
Last active March 7, 2018 02:16
diffing_algos
big_arr = (0..900_000).to_a
sm_arr = (0..700_000).to_a
def diff(big, sm)
(big - sm)
end
def similarities(big, sm)
(big & sm)
end
#[derive(Debug)]
struct User {
first_name: &'static str,
last_name: &'static str,
}
impl User {
fn new(first_name: &'static str, last_name: &'static str) -> User {
User {
first_name: first_name,
function cmxs {
alias cmxsh="chmod +x ./scripts/*.sh"
function meta_mod {
echo $cmxsh >> ./scripts/chmodx.sh && $cmxsh
}
if [ -d scripts ]
then
meta_mod