Skip to content

Instantly share code, notes, and snippets.

View mortoray's full-sized avatar

edA-qa mort-ora-y mortoray

View GitHub Profile

Basics

# Create a list
mylist = []

# Add an element to the front or back
mylist.append( "abc" )
mylist.insert(0, "def")
use std::ops::*;
#[derive(Default, Clone, Copy, Debug)]
pub struct Point2 {
pub x: f64,
pub y: f64,
}
impl Point2 {
pub fn at( x : f64, y : f64 ) -> Self {
use std::ops::*;
#[derive(Default,Copy,Clone,Debug,PartialEq)]
pub struct IPoint2 {
pub x : i32,
pub y : i32,
}
impl IPoint2 {
pub fn at( x : i32, y : i32 ) -> Self {
use ipoint2::*;
#[derive(Clone,Debug)]
pub struct Matrix<T> {
cells : Box<[T]>,
pub width : i32,
pub height : i32,
}
impl<T : Copy + Default> Matrix<T> {
fn main() {
let mut i = "".into();
std::io::stdin().read_line(&mut i);
let mut q:Vec<i8>= i.split(" ").map(|s|s.trim().parse().unwrap()).collect();
loop {
if q[1]>q[3]{print!("S");q[3]+=1;}
let s = (q[0]-q[2]).signum();
q[2] += s;
println!("{}", ["W","","E"][(s+1) as usize]);
@mortoray
mortoray / javascript_cheat_sheet.md
Last active February 7, 2018 13:36
JavaScript Cheat Sheet

JavaScript Cheat Sheet

Class Members

class Tuxedo {
	constructor( args ) { 
		this.propName = someValue
	}
	
@mortoray
mortoray / image_density.md
Last active August 29, 2015 14:16
Handling density in images

The desire of this proposal is to make a system that works with a minimal number of assets and a minimal syntax. It retains pixel crispness when possible, but still presents a usably sized display on all devices. It also optionally allows for using multiple images to get better clarity on multiple devices when a project can afford to produce multiple assets.

Basic

A user creates a single image.png file and should be able to use this in the interface like this:

<Image ux:File="image.png"/>

This should work across all devices, that is ones with different screen densities. It won't be significantly larger or smaller if the target screen density differs. It produces a predictable UI layout.