Skip to content

Instantly share code, notes, and snippets.

@mynyml
mynyml / README.md
Last active January 27, 2023 10:05
CSS custom list counter with leading zeros and optional reverse order
@mynyml
mynyml / dropbox_ignore_pattern.bash
Last active September 18, 2020 04:13
Mark files to be ignored by dropbox based on pattern. Example with node_modules directories.
# ignore `node_modules` directories recursively.
# see https://help.dropbox.com/files-folders/restore-delete/ignored-files
# apt install attr
LC_ALL=C find . -type d -regextype posix-extended -regex '.*/node_modules' -prune 2> >(grep -v 'Permission denied' >&2) | while read -r path; do attr -s com.dropbox.ignored -V 1 "$path"; done;
@mynyml
mynyml / 1_kubernetes_on_macOS.md
Created August 20, 2018 19:59 — forked from kevin-smets/1_kubernetes_on_macOS.md
Local Kubernetes setup on macOS with minikube on VirtualBox and local Docker registry

Requirements

Minikube requires that VT-x/AMD-v virtualization is enabled in BIOS. To check that this is enabled on OSX / macOS run:

sysctl -a | grep machdep.cpu.features | grep VMX

If there's output, you're good!

Prerequisites

### Keybase proof
I hereby claim:
* I am mynyml on github.
* I am maumont (https://keybase.io/maumont) on keybase.
* I have a public key ASAFSRRffQrdhjhVEKGrKI5UFXXdQ_UMFpSZcyV2xsinYgo
To claim this, I am signing this object:
@mynyml
mynyml / stdoutAndThrow.coffee
Created February 12, 2011 19:50
Thrown Error not raised unless data gets printed to stdout beforehand
# NOTE:
# uncommenting either of the two `console.log ''` lines bellow will "fix" the problem, and the error message will be printed to stdout.
# Also interesting: if the line `console.log 'in finally'` is replaced with `util.debug 'in finally'`, the problem comes back (i.e. even with the log lines uncommented)
require('path').exists '/tmp/alskdjf', (exists) ->
try
# console.log ''
throw new Error
finally
console.log 'in finally'
@mynyml
mynyml / comprehension_scope.coffee
Created January 22, 2011 21:06
execution scope of _ref in array comprehensions is non-intuitive
bar = ->
foo()
foo = ->
v for k,v of arguments.callee.caller.arguments
console.log bar('x','y') #=> ['x','y']
foo = ->
args = (v for k,v of arguments.callee.caller.arguments)
class Foo
@bar: -> 'bar'
# baz: -> Foo.bar()
baz: -> @constructor.bar()
class Boo extends Foo
@bar: -> 'moo'
function createNamedFunction() {
var _cnf = Array.prototype.slice.call(arguments, 0);
_cnf.name = _cnf.shift();
_cnf.code = _cnf.pop();
return new Function('return function NAME(ARGS) {CODE}'.
replace('NAME', _cnf.name).
replace('ARGS', _cnf.join(',')).
replace('CODE', _cnf.code))();
}
~/dev/tmp| irb
>> a = File.open('foo')
=> #<File:foo>
>> File.open('foo', 'w') {|f| f << 'foo' }
=> #<File:foo (closed)>
>> a.rewind; a.read
=> "foo"
>> File.open('foo', 'w') {|f| f << 'bar' }
=> #<File:foo (closed)>
>> a.rewind; a.read
Java Logging is Awesome
=======================
### Since I am incapable of determining information about my own runtime environment, please provide it to me. Also, this is from a *library* and there's no obvious way to turn it off, rendering DEBUG logging statements from my own application all but useless.
DEB [20100119-17:50:05.225] httpclient: Java version: 1.6.0_15
DEB [20100119-17:50:05.225] httpclient: Java vendor: Apple Inc.
DEB [20100119-17:50:05.226] httpclient: Java class path: /Users/james/bin/sbt-launcher.jar
DEB [20100119-17:50:05.226] httpclient: Operating system name: Mac OS X
DEB [20100119-17:50:05.226] httpclient: Operating system architecture: x86_64