Skip to content

Instantly share code, notes, and snippets.

@MethodGrab
MethodGrab / README.md
Last active February 22, 2023 14:15
Jenkins NodeJS Plugin: Missing nodejs.org installers

Jenkins NodeJS Plugin: Missing nodejs.org installers

Versions

  • Ubuntu 14.04 LTS x64
  • Java 1.7
  • Jenkins 1.639
  • NodeJS plugin 0.2.1
@MethodGrab
MethodGrab / macOS External Display Fix.md
Last active November 16, 2022 20:54
A fix for blurry text on external displays in macOS & OS X

macOS External Display Fix

A fix for blurry text on external displays in macOS & OS X.

  1. Run the patch (src) which will create a new directory in the CWD called DisplayProductID-YYYY:

    ruby ./patch-edid.rb
  2. Reboot into recovery mode (hold down CMD-R while rebooting)

@MethodGrab
MethodGrab / background.js
Created August 19, 2020 15:07 — forked from danharper/background.js
Bare minimum Chrome extension to inject a JS file into the given page when you click on the browser action icon. The script then inserts a new div into the DOM.
// this is the background code...
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
file: 'inject.js'
});
});
@MethodGrab
MethodGrab / pre-commit
Created July 1, 2020 12:26 — forked from kuy/pre-commit
git: pre-commit hook script to prevent committing FIXME code
#!/bin/sh
matches=$(git diff --cached | grep -E '\+.*?FIXME')
if [ "$matches" != "" ]
then
echo "'FIXME' tag is detected."
echo "Please fix it before committing."
echo " ${matches}"
exit 1

Typing vagrant from the command line will display a list of all available commands.

Be sure that you are in the same directory as the Vagrantfile when running these commands!

Creating a VM

  • vagrant init -- Initialize Vagrant with a Vagrantfile and ./.vagrant directory, using no specified base image. Before you can do vagrant up, you'll need to specify a base image in the Vagrantfile.
  • vagrant init <boxpath> -- Initialize Vagrant with a specific box. To find a box, go to the public Vagrant box catalog. When you find one you like, just replace it's name with boxpath. For example, vagrant init ubuntu/trusty64.

Starting a VM

  • vagrant up -- starts vagrant environment (also provisions only on the FIRST vagrant up)
@MethodGrab
MethodGrab / styles.less
Last active January 19, 2018 13:00
Atom styles to disable ligatures on the active line
// Disable ligatures on the active line
// https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-ligatures
atom-text-editor.editor {
.line.cursor-line {
font-variant-ligatures: none;
}
}
@MethodGrab
MethodGrab / better-nodejs-require-paths.md
Created September 18, 2016 16:41 — forked from branneman/better-nodejs-require-paths.md
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

var Article = require('../../../models/article');

Those suck for maintenance and they're ugly.

Possible solutions

Difference between Debounce and Throttle

Debounce

Debounce a function when you want it to execute only once after a defined interval of time. If the event occurs multiple times within the interval, the interval is reset each time.
Example A user is typing into an input field and you want to execute a function, such as a call to the server, only when the user stops typing for a certain interval, such as 500ms.

Throttle

@MethodGrab
MethodGrab / gist:79b792ab4185e358e7ce482ac6373f9d
Created August 10, 2016 16:30 — forked from clintel/gist:1155906
Fenced code in bullet lists with GitHub-flavoured MarkDown??

Fenced code blocks inside ordered and unordered lists

  1. This is a numbered list.

  2. I'm going to include a fenced code block as part of this bullet:

    Code
    More Code