Skip to content

Instantly share code, notes, and snippets.

View lukebrooker's full-sized avatar

Luke Brooker lukebrooker

View GitHub Profile
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@AvnerCohen
AvnerCohen / npm-cheat-sheet.md
Last active July 9, 2023 09:14
Node.js - npm Cheat Sheet

Node.js - npm Cheat Sheet

(Full description and list of commands at - https://npmjs.org/doc/index.html)

List of less common (however useful) NPM commands

Prepand ./bin to your $PATH

Make sure to export your local $PATH and prepand relative ./node_modules/.bin/:

@seanf
seanf / git-pr
Last active December 19, 2015 06:59
Push current branch to github, enable tracking and open the pull request page
#!/bin/bash
this_branch=$(git rev-parse --abbrev-ref HEAD)
github_project=https://github.com/zanata/zanata-server
base_branch=integration/master
read -p "Push branch \"$this_branch\" to github, enable tracking, and open pull request page (y/n)? " -n 1 -r choice
if [[ $choice =~ ^[Yy]$ ]]; then
git push -u origin $this_branch
xdg-open ${github_project}/compare/${base_branch}...${this_branch}
fi
@OverZealous
OverZealous / 1 gulpfile.js
Last active May 26, 2016 19:39
Gulpfile for replicating ngboilerplate
//<editor-fold desc="Node Requires, gulp, etc">
var gulp = require('gulp'),
autoprefixer = require('gulp-autoprefixer'),
clean = require('gulp-clean'),
concat = require('gulp-concat'),
csso = require('gulp-csso'),
debug = require('gulp-debug'),
footer = require('gulp-footer'),
gutil = require('gulp-util'),
gzip = require('gulp-gzip'),
@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) {
@vegetableman
vegetableman / gist:e9ed4df769c49343af84
Created May 13, 2014 18:02
Scroll Cloaking on reactjs
/**
* @jsx React.DOM
*/
// Parent
var React = require('react'),
BlockItemView = require('./BlockItemView.jsx');
module.exports = BlockView = React.createClass({displayName: 'BlockView',
@ericelliott
ericelliott / essential-javascript-links.md
Last active May 17, 2024 03:38
Essential JavaScript Links
@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.