Skip to content

Instantly share code, notes, and snippets.

<script type="text/babel">
const manuallyMakeElement = (props) => {
return React.createElement('div', {className: 'container'}, props.children)
}
const message = (props) => {
return props.children + ' ' + props.other_thing
}
const passFunctionIntoElement = React.createElement(message, {children: 'Pass function', other_thing: 'into'})
'body':
'ctrl-tab': 'pane:show-next-item'
'ctrl-tab ^ctrl': 'unset!'
'ctrl-shift-tab': 'pane:show-previous-item'
'ctrl-shift-tab ^ctrl': 'unset!'
@thedch
thedch / deadcode.sh
Created January 25, 2020 19:04
A bunch of greps strung together to find unused classes in Python. May have bugs.
#!/bin/bash
# there's probably (definitely?) a better way to do this, but it seems to work.
classes=$(grep -oEh "^class \w+[\(:]" * | cut -c 7- | sed 's/.\{1\}$//')
for c in $classes ; do
grep $c * | grep -vq "class" || echo $c
done
def examine(x):
iam = str(type(x))
try: return iam + ' ' + examine(x[0])
except: return iam
def main():
print(examine([[[[1,2,3,]]]]))
@thedch
thedch / same-line-print.py
Created July 30, 2018 22:06
Easy progress bar style print on the same line
from time import sleep
def main():
for i in range(10):
print('Counter:', i, end='\r')
sleep(.1)
if __name__ == '__main__':
[
{ "keys": ["super+\\"], "command": "toggle_side_bar" },
{ "keys": ["ctrl+tab"], "command": "next_view" },
{ "keys": ["ctrl+shift+tab"], "command": "prev_view" },
{ "keys": ["super+shift+f"], "command": "show_panel", "args": {"panel": "replace", "reverse": false} },
]
{
"auto_find_in_selection": true,
"close_windows_when_empty": true,
"ensure_newline_at_eof_on_save": true,
"find_selected_text": true,
"font_size": 13,
"hot_exit": false,
"ignored_packages":
[
"Vintage"
fig,axes=plt.subplots(3, 4, figsize=(10,5))
for i, ax in enumerate(axes.flat):
ax.imshow(img)
plt.tight_layout()
@thedch
thedch / asana.py
Last active December 21, 2021 02:44
Helper functions to create a task in a specific section in Asana
# The current Asana Python client does not seem to support task creation in a given section.
# The API documentation is also somewhat lacking, and there's some conflicting instructions on various forums.
# After a bit of searching + trial and error, I figured out how to do it using the requests library.
# I'm posting these helper functions here for anyone who may need them in the future.
import requests
import json
headers = {
'Content-Type': 'application/json',
@thedch
thedch / ROS-link
Created January 27, 2018 23:36
ROS