Skip to content

Instantly share code, notes, and snippets.

View nalply's full-sized avatar
😆
Being a Father

Daniel Ly nalply

😆
Being a Father
View GitHub Profile
@nalply
nalply / config.toml
Created September 14, 2023 14:47
helix configuration including foot (terminal)
theme = "nalp"
[editor]
cursorline = true
rulers = [72, 79, 99, 119]
#bufferline = "multiple"
color-modes = true
auto-pairs = false
[editor.cursor-shape]
@nalply
nalply / Cargo.toml
Created March 22, 2022 19:23
Minimal example for `Arc<str>` bincode fail
[package]
name = "minimal_example"
version = "0.1.0"
edition = "2021"
[dependencies]
bincode = "2.0.0-rc.1"
@nalply
nalply / gist:6bcb91154df56b58974a65ebb3f0b492
Last active August 20, 2017 19:15
Youtube user script to hide recommendations and to redirect to a blank page after a video has ended. No guarantee given that it works.
// Remove sidebar repeatedly
setInterval(function() {
const sidebar = document.querySelector('#watch7-sidebar')
if (sidebar && sidebar.remove) sidebar.remove()
const sidebarModules = document.querySelector('#watch7-sidebar-modules')
if (sidebarModules && sidebarModules.remove) sidebarModules.remove()
console.log('test')
}, 500)
// Remove player after it has been stopped
makeErrorByStatus = function(statusCode, content) {
let message = `failed [${statusCode}]`;
if (content) {
const stringContent = typeof content == "string" ?
content : content.toString();
message += ' ' + truncate(stringContent.replace(/\n/g, ' '), MAX_LENGTH);
}
#!/bin/bash
# Run this script just before you put the laptop in the bin for security scanning.
# You can add the seconds the laptop will be waiting before speaking. The default
# is waiting for 180 seconds (3 minutes).
# Switch to the login screen, effectively locking the screen.
function lockscreen() {
/System/Library/CoreServices/"Menu Extras"/User.menu/Contents/Resources/CGSession -suspend
}
@nalply
nalply / Result
Last active August 29, 2015 13:55
Test 1: Non-enumerable property by prototype in a Handlebars expression.
Expected: «Hello World by prototype»
Actual: «»
------------------------------------------------------------------------
Test 2: Instance property in a Handlebars expression.
Expected: «Hello World by field»
Actual: «Hello World by field»
------------------------------------------------------------------------
Test 3: Same non-enumerable property in a Handlebars helper.
Expected: «Hello World by prototype»
@nalply
nalply / redirect_on_dep.html
Last active August 29, 2015 13:55
This is a minimal Meteor app. You go to an option by its link. Or use the select. It's the same. See: https://groups.google.com/forum/#!topic/meteor-talk/b1BAUN50zQg
<template name="index">
{{#each list}}<a href="{{pathFor 'select'}}">{{text}}</a><br>{{/each}}
</template>
<template name="select">
<a href="/">Home</a> -
<a href="/ex2">Select ex2</a>
<br><br>
<select>{{#each list}}
<option value="{{id}}" {{#if selected id}}selected{{/if}}>{{text}}</option>
// Benchmark typeof object.key === 'undefined' to 'key' in object
var sys = require("sys")
function randomKey(n) {
var letters = "abcdefghijklmnopqrstuvwxyz"
var key = ""
for (var i = 0; i < n; i++) key += letters[Math.floor(Math.random() * 26)]
return key
}