Skip to content

Instantly share code, notes, and snippets.

View nfreear's full-sized avatar

Nick Freear nfreear

View GitHub Profile
@paulirish
paulirish / how-to-view-source-of-chrome-extension.md
Last active April 25, 2024 04:16
How to view-source of a Chrome extension

Option 1: Command-line download extension as zip and extract

extension_id=jifpbeccnghkjeaalbbjmodiffmgedin   # change this ID
curl -L -o "$extension_id.zip" "https://clients2.google.com/service/update2/crx?response=redirect&os=mac&arch=x86-64&nacl_arch=x86-64&prod=chromecrx&prodchannel=stable&prodversion=44.0.2403.130&x=id%3D$extension_id%26uc" 
unzip -d "$extension_id-source" "$extension_id.zip"

Thx to crxviewer for the magic download URL.

@sgnl
sgnl / postgres-brew.md
Last active April 21, 2024 23:18
Installing Postgres via Brew (OSX) (outdated see top most note)

Outdated note: the process is a lot easier now: after you brew install postgresql you can initialize or stop the daemon with these commands: brew services start postgresql or brew services stop postgresql.

new out put may look like

To have launchd start postgresql now and restart at login:
  brew services start postgresql
Or, if you don't want/need a background service you can just run:
  pg_ctl -D /usr/local/var/postgres start
@varemenos
varemenos / 1.README.md
Last active April 21, 2024 23:21
Git log in JSON format

Get Git log in JSON format

git log --pretty=format:'{%n  "commit": "%H",%n  "abbreviated_commit": "%h",%n  "tree": "%T",%n  "abbreviated_tree": "%t",%n  "parent": "%P",%n  "abbreviated_parent": "%p",%n  "refs": "%D",%n  "encoding": "%e",%n  "subject": "%s",%n  "sanitized_subject_line": "%f",%n  "body": "%b",%n  "commit_notes": "%N",%n  "verification_flag": "%G?",%n  "signer": "%GS",%n  "signer_key": "%GK",%n  "author": {%n    "name": "%aN",%n    "email": "%aE",%n    "date": "%aD"%n  },%n  "commiter": {%n    "name": "%cN",%n    "email": "%cE",%n    "date": "%cD"%n  }%n},'

The only information that aren't fetched are:

  • %B: raw body (unwrapped subject and body)
  • %GG: raw verification message from GPG for a signed commit
@flesler
flesler / index.html
Last active September 11, 2021 13:16
Anchor navigation powered by jquery.scrollTo
<!-- Include jQuery from somewhere, must use version 1.8 or above -->
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<!-- Include latest jquery.scrollTo, can download from https://github.com/flesler/jquery.scrollTo/releases -->
<script type="text/javascript" src="//cdn.jsdelivr.net/jquery.scrollto/2.1.2/jquery.scrollTo.min.js"></script>
<!-- Initialize the plugin, the contents of the script can be inlined here, of course -->
<script type="text/javascript" src="js/init.js"></script>
@nfreear
nfreear / iet_wp_query_shortcode.php
Created March 14, 2015 23:40
Shortcode [wp_query] wrapper around WordPress core function: `wp_query` | https://github.com/IET-OU/wp-iet-generic-plugins [LACE]
<?php
/*
Plugin Name: IET WP_Query
Plugin URI: https://github.com/IET-OU/oer-evidence-hub-org
Description: Shortcode [wp_query] wrapper around WordPress core function: `wp_query` [LACE]
Author: Nick Freear [@IET-OU]
Author URI: https://github.com/IET-OU
Version: 0.1
*/
@a-r-m-i-n
a-r-m-i-n / .gitattributes
Last active July 19, 2018 09:25
.gitattributes to force LF for all text files
# Autodetect text files
* text=auto
# Force the following filetypes to have unix eols, so Windows does not break them
*.* text eol=lf
# Force images/fonts to be handled as binaries
*.jpg binary
*.jpeg binary
*.gif binary
@domenic
domenic / 0-github-actions.md
Last active April 8, 2024 23:35
Auto-deploying built products to gh-pages with Travis

Auto-deploying built products to gh-pages with GitHub Actions

This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.

A file below this one contains the steps for doing this with Travis CI. However, these days I recommend GitHub Actions, for the following reasons:

  • It is much easier and requires less steps, because you are already authenticated with GitHub, so you don't need to share secret keys across services like you do when coordinate Travis CI and GitHub.
  • It is free, with no quotas.
  • Anecdotally, builds are much faster with GitHub Actions than with Travis CI, especially in terms of time spent waiting for a builder.
var defaults = {
number: 1,
bool: true,
magic: 'real',
animal: 'whale',
croutons: 'delicious'
};
var options = {
number: 2,
@oilvier
oilvier / bookmark.js
Last active February 14, 2024 10:29
Javascript to add a bookmark - Cross Browser
/**
*
* Add to bookmark
* Several tests are necessary in order for this "simple" action to work in most of the browsers
*
*/
// First, we define the element where the "Add to bookmark" action will trigger
var triggerBookmark = $(".js-bookmark"); // It must be an `a` tag
["Life isn’t about getting and having, it’s about giving and being.", "Kevin Kruse"]
["Whatever the mind of man can conceive and believe, it can achieve.", "Napoleon Hill"]
["Strive not to be a success, but rather to be of value.", "Albert Einstein"]
["Two roads diverged in a wood, and I—I took the one less traveled by, And that has made all the difference.", "Robert Frost"]
["I attribute my success to this: I never gave or took any excuse.", "Florence Nightingale"]
["You miss 100% of the shots you don’t take.", "Wayne Gretzky"]
["I’ve missed more than 9000 shots in my career. I’ve lost almost 300 games. 26 times I’ve been trusted to take the game winning shot and missed. I’ve failed over and over and over again in my life. And that is why I succeed.", "Michael Jordan"]
["The most difficult thing is the decision to act, the rest is merely tenacity.", "Amelia Earhart"]
["Every strike brings me closer to the next home run.", "Babe Ruth"]
["Definiteness of purpose is the starting point of all achievement.", "W.