Skip to content

Instantly share code, notes, and snippets.

View drhayes's full-sized avatar
🐱

David Hayes drhayes

🐱
View GitHub Profile
@abeppu
abeppu / feelbetter.js
Last active February 6, 2021 19:06
Implementation of @FeelBetterBot
var Twit = require("twit");
var config = require('./oauthconfig');
console.log("config:");
console.log(config);
var T = new Twit({
consumer_key: config.consumer_key,
consumer_secret: config.consumer_secret,
access_token: config.access_token,
@danpe
danpe / Sublime Text 3 Environment Variables
Created October 15, 2013 18:56
Sublime Text 3 Environment Variables
List of all Sublime Text 3 Environment Variables to be used by Snippet Makers / Plugin Developers
$SELECTION The text that was selected when the snippet was triggered.
$TM_CURRENT_LINE Content of the line the cursor was in when the snippet was triggered.
$TM_CURRENT_WORD Current word under the cursor when the snippet was triggered.
$TM_FILENAME File name of the file being edited including extension.
$TM_FILEPATH File path to the file being edited.
$TM_FULLNAME User’s user name.
$TM_LINE_INDEX Column the snippet is being inserted at, 0 based.
$TM_LINE_NUMBER Row the snippet is being inserted at, 1 based.
@igroff
igroff / getTimezoneOffsetHoursAndMinutes.js
Last active September 4, 2015 15:39
getTimezoneOffsetHoursAndMinutes -- Really, is this not already somewhere?
// name is still bad, have yet to figure what would be more correct
// sign change differences make re-using the TimezoneOffset verbage
// confusing
Date.prototype.getTimezoneOffsetHoursAndMinutes = function(){
// offset in minutes
var tzo = this.getTimezoneOffset();
// determine 'direction' from GMT we are
// if offset is positive, we're 'in the past'
var behindGMT = tzo > 0;
// work in positive
@razwan
razwan / _baseline.scss
Created April 14, 2014 16:20
Aligning type to baseline the right way with SASS
$base-font-size: 16px;
$base-line-height: 1.5;
// this value may vary for each font
// unitless value relative to 1em
$cap-height: 0.68;
@mixin baseline($font-size, $scale: 2) {
@staltz
staltz / introrx.md
Last active May 11, 2025 22:46
The introduction to Reactive Programming you've been missing
@addyosmani
addyosmani / README.md
Last active May 10, 2025 11:24 — forked from 140bytes/LICENSE.txt
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

@tylerneylon
tylerneylon / json.lua
Last active March 31, 2025 01:08
Pure Lua json library.
--[[ json.lua
A compact pure-Lua JSON library.
The main functions are: json.stringify, json.parse.
## json.stringify:
This expects the following to be true of any tables being encoded:
* They only have string or number keys. Number keys must be represented as
strings in json; this is part of the json spec.
@duanefields
duanefields / AngularController.coffee
Last active June 8, 2016 00:55
CoffeeScript Base Classes for AngularJS
module.exports = class AngularController
# register the subclass with angular, module and name are optional
@register: (name, module) ->
module ?= @module || angular.module 'controllers'
name ?= @name || @toString().match(/function\s*(.*?)\(/)?[1]
module.controller name, @
# inject the list of dependencies, as a list of Strings
@inject: (args...) ->
@ericelliott
ericelliott / essential-javascript-links.md
Last active March 22, 2025 17:28
Essential JavaScript Links
@julianlam
julianlam / expose-directory-on-host-to-lxc-container.md
Last active March 22, 2025 08:11
Exposing a directory on the host machine to an LXC container #blog

Exposing a directory on the host machine to an LXC container

  1. Log into the container and create an empty directory, this will be the mount point
  2. Log out and stop the container.
  3. Open to your container's config file
    • For regular LXC containers: /var/lib/lxc/mycontainer/config
    • For unprivileged LXC containers: $HOME/.local/share/lxc/mycontainer/config
  4. Add a new line above the lxc.mount directive, that follows the format below. Substitute proper paths as necessary:
    • lxc.mount.entry = /path/to/folder/on/host /path/to/mount/point none bind 0 0
  • Both of these paths are relative to the host machine.