Skip to content

Instantly share code, notes, and snippets.

@jdtsmith
jdtsmith / test_treesitter.el
Last active August 20, 2023 12:30
tree-sitter navigation speed test
(let (cnt tm node res)
(goto-char (point-min))
(while (< (point) (point-max))
(setq tm
(benchmark-run 100
(setq node (treesit-node-at (point)))
(while node
(setq node (treesit-node-parent node))))
node (treesit-node-at (point)))
(setq cnt 0)
setInterval(function() {
if (Molpy.Redacted.location != 0) {
document.title = "! kitten !";
Molpy.Redacted.location=1;
var inputz = document.getElementsByTagName("input");
for(index = 0; index < inputz.length; index++){
if(inputz[index].value == "Show"){
var foundIt = String(inputz[index].onclick).includes("Redacted");
# Luke's config for the Zoomer Shell
# Enable colors and change prompt:
autoload -U colors && colors
PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b "
# History in cache directory:
HISTSIZE=10000
SAVEHIST=10000
HISTFILE=~/.cache/zsh/history
@klmr
klmr / list_comprehension.r
Created February 12, 2016 15:17
Haskell-like list comprehension for R
# Dummy object, only required for name resolution.
set = structure(list(), class = 'set')
print.set = function (x, ...) invisible(x)
`[.set` = function (set, expr, filter) {
expr = substitute(expr)
filter = substitute(filter)
stopifnot(identical(expr[[1]], quote(`<-`)))
stopifnot(identical(expr[[2]][[1]], quote(`|`)))
@hrbrmstr
hrbrmstr / daylight.r
Created November 2, 2015 13:36
update to daylight
library(maptools)
library(ggplot2)
library(gridExtra)
library(scales)
library(jsonlite)
# adapted from http://r.789695.n4.nabble.com/maptools-sunrise-sunset-function-td874148.html
ephemeris <- function(lat, lon, date, span=1, tz="UTC") {
lon.lat <- matrix(c(lon, lat), nrow=1)
@pbugnion
pbugnion / ipython_notebook_in_git.md
Last active October 22, 2023 12:25
Keeping IPython notebooks under Git version control

This gist lets you keep IPython notebooks in git repositories. It tells git to ignore prompt numbers and program outputs when checking that a file has changed.

To use the script, follow the instructions given in the script's docstring.

For further details, read this blogpost.

The procedure outlined here is inspired by this answer on Stack Overflow.

// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';