Skip to content

Instantly share code, notes, and snippets.

View mikebranski's full-sized avatar

Mike Branski mikebranski

View GitHub Profile
// From the command authoring tutorial
CmdUtils.CreateCommand({
name: "date",
homepage: "http://www.leftrightdesigns.com/",
author: {name: "Mike Branski", email: "mikebranski@gmail.com"},
description: "Inserts today's date.",
help: "If you're in an editable text area, inserts today's date, formatted for the current locale.",
_date: function() {
var date = new Date();
/* CSS for Comments Module for Virb 2's Photographer profile skin */
/*************************************************
* COMMENTS
*************************************************/
#comments.module {
border-top-width: 5px;
}
/*
================================
* CLASSIC (PORTFOLIO)
supported modules:
* Profile Pic
* Display Name
* Connect
* Meta
@mikebranski
mikebranski / gist:73465
Created March 3, 2009 19:16
Layer One - slider examples
$(document).ready(function() {
/*
* Original
*/
$(".sliderContent").addClass("overflowSliderContent");
$(".sliderContent").children().addClass("hiddenSliderContent");
$(".sliderContent").each(function(i) { $($(this).children().get(0)).removeClass("hiddenSliderContent"); });
@mikebranski
mikebranski / gist:1226710
Created September 19, 2011 15:08
Nested HTML Lists
<!-- INCORRECT -->
<ul>
<li>First bulleted item</li>
<li>Second bulleted item</li>
<ol>
<li>First nested number</li>
</ol>
</ul>
<!-- CORRECT -->
@mikebranski
mikebranski / editor.plugin.zsh
Created March 27, 2015 21:29
oh-my-zsh editor plugin
# Quick shortcut to the specified editor ($EDITOR).
# Adapted from @holman's .dotfiles.
#
# To install:
# Copy script to $ZSH/custom/plugins/editor/editor.plugin.zsh
# Add `editor` to the list of plugins included by oh-my-zsh
#
# If you're not using oh-my-zsh, you can just drop this in your shell profile
# (e.g. ~/.zshrc, ~/.bash_profile, etc)
#
/**
* This Google Sheets script keeps data in the specified column sorted any time
* the data changes.
*
* After much research, there wasn't an easy way to automatically keep a column
* sorted in Google Sheets, and creating a second sheet to act as a "view" to
* my primary one in order to achieve that was not an option. Instead, I
* created a script that watches for when a cell is edited and triggers
* an auto sort.
*
// Super swanky pseudo-code that prevents customers like me from losing their support message
// when they fat finger the wrong button and navigate away before they're done.
// Making some assumptions about Simple's code. :D
var Simple = Simple || {};
Simple.confirmLeavingSupportMessage = "Hold up! You'll lose what you started typing if you leave.";
// Checks if the customer has started typing a message to support.
Simple.hasDirtySupportMessageField = function() {
@mikebranski
mikebranski / count-the-fives.md
Created February 16, 2017 22:30
JavaScript exercise dealing with arrays

Count The Fives

Explanation: Create a function the takes an Array of numbers and returns an Integer count of the number of 5's in the Array

Bloc Objective: Write a for loop.

Content:

// Create a function the takes an Array of numbers and returns an
@mikebranski
mikebranski / closures-and-scopes.md
Created February 17, 2017 22:40
Bloc JS Closures / Scoping exercises

JS Closures / Scoping exercises

  1. What’s the result of executing this code and why.
function test() {
   console.log(a);
   console.log(foo());
   
   var a = 1;
   function foo() {