Skip to content

Instantly share code, notes, and snippets.

C:\Windows\System32\Robocopy.exe /E /R:3 /W:10 /FP /MT:25 /V "<SOURCE_DIRECTORY>" "<TARGET_DIRECTORY>"
ls | Sort-Object LastWriteTime | select -last 10
rmdir /s /q <DIRECTORY_TO_DELETE>
Robocopy.exe /E /R:3 /W:10 /FP /MT:25 /V "<SOURCE_DIRECTORY>" "<TARGET_DIRECTORY>"
@chamakits
chamakits / sample-stimulus.js
Created February 22, 2020 00:33
StimulusJS Adding Elements Dynamically
class AutocompleteController extends Stimulus.Controller {
static get targets() {
return [ "results" ]
}
initialize() {
this.fakeFetch()
setInterval(this.fakeFetch.bind(this), 1500)
}
javascript: function runDownloadThing(howManyToDownload) {
if (!howManyToDownload) {
howManyToDownload = 3;
}
if (window['downloadSome']) {
window.downloadSome();
return;
}
var iter = $('div.download a.a:not([download])').toArray();
iter = iter.concat($('div.row a[download]').toArray());
@chamakits
chamakits / weird_borrowing_error.rs
Last active June 24, 2016 05:44 — forked from anonymous/playground.rs
Problemataic borrowing
struct NoLifetime {}
struct WithLifetime <'a> {
pub field: &'a i32
}
fn main() {
let mut some_val = NoLifetime{};
borrow_mut_function(&mut some_val);
borrow_mut_function(&mut some_val);//Borrowing as mutable for the second time.
let num = 5;
@chamakits
chamakits / playground.rs
Created June 24, 2016 05:11 — forked from anonymous/playground.rs
Shared via Rust Playground
struct StructNoLifetime {}
impl StructNoLifetime {
pub fn do_nothing(&mut self) {
}
}
struct StructWithLifetime <'a> {
pub field: &'a i32
}
fn main() {
@chamakits
chamakits / hello_rust1-1_prints.rs
Last active June 14, 2016 03:34 — forked from anonymous/playground.rs
Shared via Rust Playground
fn main() {
println!("Hello everyone!");
println!(r#"First line!
We are here to learn about the language "{}",
a really neat language."#,
"Rust");
println!("Multiline.\
Ignores leading whitespace and newline");
}
macro_rules! assign_do_nothing {
( $( $x:expr ),* ) => {
{
$(
let _curr = $x;
)*
}
};
}