Skip to content

Instantly share code, notes, and snippets.

@tallus
tallus / jsquickstart.md
Last active July 8, 2021 15:04
Node JS Quck start cheat sheet

Node/JS Quick start

If you are in a hurry you can fork/download this repo which has example tests and the relevant packages already set up: https://github.com/coopdigital/quickstartjest

This should get you to the point of writing a first test. It assumes OS X with homebrew installed. (see https://brew.sh/)

On Linux you should be able to substitute apt-get, yum etc when brew is mentioned. It might help to have node and npm already installed but we will be wrapping tooling around these.

This is geared towards Node but it should be the same for front-end code with test AFAIK (feel free to correct me).

@tallus
tallus / syntax.clj
Created November 24, 2017 17:00
Cloure Syntax Notes
;; this is a comment
;; Never use single quotes allways use double quotes
;; % is like an anonymous function argumenrt
;; assignment
;; globally scoped to name-space
(def foo 1)
(== foo 1) ;; true
@tallus
tallus / python-slack-bot.txt
Last active February 19, 2016 17:23
Python/Slack bot Links
https://medium.com/@julianmartinez/how-to-write-a-slack-bot-with-python-code-examples-4ed354407b98
https://medium.com/@julianmartinez/how-to-write-a-slack-bot-end-to-end-d6a8542c854b
https://api.slack.com/
https://api.slack.com/bot-users
https://github.com/slackhq/python-slackclient
https://github.com/slackhq/python-rtmbot
https://github.com/llimllib/limbo
https://github.com/loisaidasam/pyslack
@tallus
tallus / things_that_might_be_useful.md
Last active August 19, 2016 17:23
Things that might be useful...

...if only I could remember them.

Tools, modules etc. See also: tip sheet.

Python

@tallus
tallus / sh_resources.md
Last active August 19, 2016 17:24
Things to make the shell more awesome (maybe)
@tallus
tallus / gist:9e8f20200f4647d60fe5
Created July 20, 2015 18:42
python slackbot links
https://medium.com/@julianmartinez/how-to-write-a-slack-bot-with-python-code-examples-4ed354407b98
https://medium.com/@julianmartinez/how-to-write-a-slack-bot-end-to-end-d6a8542c854b
https://api.slack.com/
https://api.slack.com/bot-users
https://github.com/slackhq/python-slackclient
https://github.com/slackhq/python-rtmbot
https://github.com/llimllib/limbo
https://github.com/loisaidasam/pyslack
@tallus
tallus / tip_sheet.md
Last active April 26, 2023 12:53
Tip Sheet

Vim Tips

  • %s/<\d\d?>/0&/g|%&&|sor r/(\d{3})%(.\d{3}){3}/|%s/<00?\ze\d//g - sort ip addresses
  • %! jq . reformat json
  • J join selected lines or present and next line if no seelection
  • gJ as above but do not adjust/remove whitespace
  • gv redo visual selection
  • :%s/\s\+$// Delete unwanted white space (at the end of lines)
  • :%s/,([^ ])/, \1/g Add spaces after commas
  • :s/MATCH/&ADD apend ADD after MATCH
  • %s/".{-}", //g .{-} non greedy match e.g. "foo", 1, "bar", 2 -> 1, 2
@tallus
tallus / IndieTumblrTheme
Last active May 28, 2023 10:49
An IndieWebify-ied Tumblr Theme
<!doctype html>
<!--[if IE 7 ]> <html lang="en" class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]> <html lang="en" class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]> <html lang="en" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!-->
<html lang="en" class="no-js"> <!--<![endif]-->
<head>
<!-- Meta tags -->
@tallus
tallus / gist:6847975
Last active December 24, 2015 19:09
Python functions that returns a list of directories in a directory, with fully qualified paths, using ridiculous list constructor that I'm quite proud of
def get_directory_list(dpath):
'''returns a list of directories in a directory,
with fully qualified paths'''
if not os.path.isdir(dpath):
raise MyError('oops %s is not a directory'% dpath)
dirs = [os.path.join(dpath, filename) for filename in os.listdir(dpath) if (os.path.isdir(os.path.join(dpath, filename)))]
return dirs