Skip to content

Instantly share code, notes, and snippets.

@mattnorris
mattnorris / bootstrap-jumbotron-mobile.less
Last active December 14, 2015 16:19
By default, Twitter Boostrap pads the body of mobile browsers with a media query. This makes your site look good in most cases, but works against you if you want a Jumbotron-style header. This code overrides the body padding, but retains it for container-fluid divs.
// Tablets and below
@media (max-width: 767px) {
// Remove the extra padding for media queries so the Jumbotron
// still spans the full width of the page, even in mobile browsers.
// Instead, move the padding into the container-fluid class.
body {
padding-left: 0;
padding-right: 0;
}
.container-fluid {
@mattnorris
mattnorris / active-nav.js
Last active March 20, 2020 10:15
Highlight the active nav link with jQuery in Twitter Bootstrap. The deprecated "navify" jQuery plugin is also included for reference. This isn't needed anymore because of Bootstrap.
// Include in a <script> tag.
$(function() {
// Highlight the active nav link.
var url = window.location.pathname;
var filename = url.substr(url.lastIndexOf('/') + 1);
$('.navbar a[href$="' + filename + '"]').parent().addClass("active");
});
@mattnorris
mattnorris / navbar-left-right.html
Created March 9, 2013 14:28
Left-justified Twitter Bootstrap nav options along with right-justified; collapsible menu for mobile devices is also illustrated.
<!--
Navbar
Source: http://twitter.github.com/bootstrap/
-->
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container-fluid">
<!-- Expand button for smaller devices -->
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
@mattnorris
mattnorris / sys_path_append.py
Created March 29, 2013 19:02
Update the system path in a Python script to find "local" files within a project. This is especially helpful for unit testing.
"""
Given the following directory structure:
project-name
docs
scripts
src
lib
test
input
@mattnorris
mattnorris / github-pages.md
Created April 4, 2013 01:56
How to create a GitHub page using Jekyll and Bootstrap

Creating Whispernote's GitHub Project Page

Jekyll, GitHub's static site generator, and Bootstrap were used to create Whispernote's GitHub Project Page. This document shows how.

Project Goals

I wanted a stylish "brand" page for my project, and I wanted to reuse the README file I had created without a lot of copy/pasting. GitHub's Jekyll allowed me to essentially embed the file as a partial. What I got was really an enhanced README file (thanks to some jQuery and Bootstrap), which is exactly what I wanted.

gh-pages

@mattnorris
mattnorris / postmkvirtualenv.sh
Created June 2, 2013 03:17
Hook that executes after virtualenv makes a new virtual environment; this script sets up a directory structure and installs some common packages in the virtual environment.
#!/bin/sh
# This hook is run after a new virtualenv is activated. It resides in the
# WORKON_HOME directory.
SITE_PKGS="lib/python2.5/site-packages" # relative path to site pacakges for easy_install
SEP="################################################################################"
cdvirtualenv
echo "Creating the project's directory structure..."
@mattnorris
mattnorris / README.md
Created September 11, 2019 21:10
Build a Webex Teams bot 🤖
@mattnorris
mattnorris / publish_to_private_npm_from_ci.md
Created May 28, 2021 19:52 — forked from silentHoo/publish_to_private_npm_from_ci.md
Push and pull into and from your private npm registry via CI pipeline

Publish to private npm registry from your CI pipeline

If you want to publish packages to your private registry, e.g. to jfrog.io/Verdaccio/... you should note some important things:

1) Authenticate on your local machine

To authenticate against the private repository, you've to use the npm cli tool. But first you should get your API access token. That's safer than using your password.

npm adduser --registry https://<registry_url>/<api_path>/ --always-auth