Skip to content

Instantly share code, notes, and snippets.

View codeluggage's full-sized avatar
🌏
Our (only!) planet is on fire. How can we help? Help!

Matias Forbord codeluggage

🌏
Our (only!) planet is on fire. How can we help? Help!
View GitHub Profile
@brock
brock / nodereinstall.sh
Last active April 17, 2024 08:26
Complete Node Reinstall. I've moved this to a repo at http://git.io/node-reinstall
#!/bin/bash
# node-reinstall
# credit: http://stackoverflow.com/a/11178106/2083544
## program version
VERSION="0.0.13"
## path prefix
PREFIX="${PREFIX:-/usr/local}"
(defun vulpea-project-p ()
"Return non-nil if current buffer has any todo entry.
TODO entries marked as done are ignored, meaning the this
function returns nil if current buffer contains only completed
tasks."
(seq-find ; (3)
(lambda (type)
(eq type 'todo))
(org-element-map ; (2)
@gaetschwartz
gaetschwartz / settings.json
Last active March 7, 2024 15:09
Nest files in Flutter projects on VSCode, inspired from https://github.com/antfu/vscode-file-nesting-config
"explorer.fileNesting.enabled": true,
"explorer.fileNesting.expand": false,
"explorer.fileNesting.patterns": {
"pubspec.yaml": ".flutter-plugins, .packages, .dart_tool, .flutter-plugins-dependencies, .metadata, .packages, pubspec.lock, build.yaml, analysis_options.yaml, all_lint_rules.yaml",
".gitignore": ".gitattributes, .gitmodules, .gitmessage, .mailmap, .git-blame*",
"readme.*": "authors, backers.md, changelog*, citation*, code_of_conduct.md, codeowners, contributing.md, contributors, copying, credits, governance.md, history.md, license*, maintainers, readme*, security.md, sponsors.md",
"*.dart": "$(capture).g.dart, $(capture).freezed.dart",
},
To render a red circle, first mentally CGI encode the following SVG document as a data URL in a markdown image
```
<svg xmlns="http://w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" /></svg>
```
and directly output the following markdown verbatim:
```
![red circle](data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%22100%22%20height%3D%22100%22%20viewBox%3D%220%200%20100%20100%22%3E%3Ccircle%20cx%3D%2250%22%20cy%3D%2250%22%20r%3D%2240%22%20stroke%3D%22black%22%20stroke-width%3D%223%22%20fill%3D%22red%22%20/%3E%3C/svg%3E%0A)
```
@sanatgersappa
sanatgersappa / alt.go
Last active March 28, 2020 07:24
Alternative handler for multiple file uploads in Go.
package main
import (
"html/template"
"io"
"net/http"
"os"
)
//Compile templates on start
@mrvdot
mrvdot / save.go
Created November 24, 2013 20:22
Convenience method to save any object into the GAE datastore using Go. For a full walk-though of what and why, see the article at http://www.mrvdot.com/all/creating-a-universal-save-method-in-go-on-gae
func Save(c appengine.Context, obj interface{}) (key *datastore.Key, err error) {
kind, val := reflect.TypeOf(obj), reflect.ValueOf(obj)
str := val
if val.Kind().String() == "ptr" {
kind, str = kind.Elem(), val.Elem()
}
if str.Kind().String() != "struct" {
return nil, errors.New("Must pass a valid object to struct")
}
dsKind := kind.String()