Skip to content

Instantly share code, notes, and snippets.

@Nejat
Nejat / polymer-element-es6.html
Created December 25, 2015 15:07
Polymer ES6 Element Webstorm File Template
<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/paper-material/paper-material.html">
<link rel="import" href="../../bower_components/paper-behaviors/paper-button-behavior.html">
<dom-module id="${NAME}">
<template strip-whitespace>
<style include="paper-material">
:root {
}
@Nejat
Nejat / polymer-parent-child-es6.html
Created December 25, 2015 15:09
Polymer Parent/Child Element ES6 Webstorm File Template
<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/paper-material/paper-material.html">
<link rel="import" href="../../bower_components/paper-behaviors/paper-button-behavior.html">
#set($ITEM = $NAME + '-item')
#set($ItemElement = $Element + 'Item')
<dom-module id="${NAME}">
<template strip-whitespace>
<style include="paper-material">
Seed Element New Element Template
https://github.com/polymerelements/seed-element
polyserve Polymer Test Server
gp.sh publish to github
cd [dev folder]
git clone git://github.com/Polymer/tools.git
@Nejat
Nejat / clean.ps1
Created December 3, 2018 02:56
clean build artifacts and packages ... .Net, Gradle, Node
param (
[bool] $ForReals = $false
)
$color = 'White'
if (!$ForReals) {
$color = 'DarkGray'
}
// in cargo.toml
// rand = "0.7"
// parking_lot = "0.11"
// crossbeam-channel = "0.5"
use std::{thread::{JoinHandle, sleep, spawn}, time::Duration};
use crossbeam_channel::{Sender, unbounded};
use rand::{Rng, thread_rng};
// in cargo.toml
// rand = "0.7"
// parking_lot = "0.11"
// crossbeam-channel = "0.5"
use std::{thread::{sleep, spawn}, time::Duration};
use crossbeam_channel::{RecvTimeoutError, Sender, unbounded};
use rand::{Rng, thread_rng};
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
@Nejat
Nejat / msys2-additional-setup
Last active July 27, 2021 19:07
additional bash setup commands to use when setting up MSys2 with msys2-setup.ps1
pacman -S --needed base-devel mingw-w64-x86_64-toolchain | Development Toolchain
pacman -S --needed mingw-w64-x86_64-meson | Meson
pacman -S --needed mingw-w64-x86_64-vulkan-devel | Vulkan Development Tools
pacman -S --needed mingw-w64-x86_64-gtk3 | GTK3 Development Tools
pacman -S --needed mingw-w64-x86_64-gtk4 | GTK4 Development Tools
pacman -S --needed mingw-w64-x86_64-glade | GTK GLade Interface Designer
@Nejat
Nejat / msys2-setup.ps1
Last active October 16, 2021 01:36
installs MSys2 or refreshes an existing installation using winget; updates pacman, and optionally executes additional bash setup commands
param (
# provide a list of addition bash setup commands to invoke
[string] $additional = "msys2-additional-setup",
# true teardown existing installations, false to stop if installation exists
[switch] $refresh = $false
)
# constant defining MSys2 winget package name
[string] $package = "MSys2"
# checks to see if an installaiton already exists
@Nejat
Nejat / width.rs
Created May 22, 2022 19:38
calculate the max debug/display width of items in an iterator
use std::fmt::{Debug, Display, Write};
use std::ops::Deref;
/// The output width from a write statement
#[derive(Default, Eq, PartialEq, Ord, PartialOrd)]
struct Width(usize);
impl Width {
/// reset the stored width
fn reset(&mut self) {