Skip to content

Instantly share code, notes, and snippets.

Avatar

G. Scott Olson gscottolson

  • Microsoft
  • Seattle, WA
View GitHub Profile
View schedule.coffee
# this functionality relies on Moment.js 2.0.0
# http://momentjs.com/docs/
$scheduleSelects = $('.schedule__select')
$scheduleYear = $('.schedule__year')
$scheduleMonth = $('.schedule__month')
$scheduleDay = $('.schedule__day')
$scheduleHour = $('.schedule__hour')
$scheduleMinute = $('.schedule__minute')
$scheduleReset = $('.schedule__reset')
View convertMarkdownToEditorState.es
import * as Ensure from '../../../../utils/lib/Ensure'
import markdownBlockDelimiter from './markdownBlockDelimiter'
import {BlockTypes, BlockTypeRegExps} from './Types'
import {
CharacterMetadata,
ContentState,
ContentBlock,
EditorState,
genKey,
} from 'draft-js'
@gscottolson
gscottolson / gist:4b859ccdbd57b77de5d7
Created Aug 7, 2015
Convert MOV to Animated GIF
View gist:4b859ccdbd57b77de5d7
mkdir ./pngs
ffmpeg -i src.mov -r 10 ./pngs/out%04d.png
mkdir ./gifs
sips -s format gif .pngs/*.png --out ./gifs
gifsicle ./gifs/* --optimize=3 --loopcount --colors 256 --resize 375x667 > ./animation.gif
@gscottolson
gscottolson / css.coffee
Created Jul 1, 2014
React CSSMixin: vendor prefixed properties
View css.coffee
module.exports = CSSMixin =
#
# Return the object containing the inline styles for `property` with
# vendor prefixes. Can be used with React inline styles:
# http://facebook.github.io/react/tips/inline-styles.html
#
getVendorPrefixedProperties: (property, value) ->
capitalizedProperty = "#{property.charAt(0).toUpperCase()}\
#{property.slice(1)}"
View ios7-safari-height-issue
/**
* Add ipad IOS7 Classes
* Allows us to temporariliy try to fix the slight scroll 100% hack.
* http://stackoverflow.com/questions/19012135/ios-7-ipad-safari-landscape-innerheight-outerheight-layout-issue
*/
if (navigator.userAgent.match(/iPad;.*CPU.*OS 7_\d/i)) {
$('html').addClass('ipad ios7');
}
/**
@gscottolson
gscottolson / Preferences.sublime-settings
Created Dec 19, 2013
My latest settings file Sublime Text 2
View Preferences.sublime-settings
{
"auto_complete": true,
"auto_complete_commit_on_tab": true,
"auto_complete_with_fields": true,
"bold_folder_labels": true,
"caret_style": "phase",
"detect_indentation": true,
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"fade_fold_buttons": false,
@gscottolson
gscottolson / index.html
Last active Dec 10, 2015
A CodePen by Hjörtur Hilmarsson. CoverFlow - CoverFlow built with CSS3 and a small doze of JavaScript
View index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>CSS3 CoverFlow</title>
<link rel="stylesheet" href="css/coverflow.css">
View gist:4267666
# If browser doesn't support placeholders, take the placeholder text and set it as the field's value
unless Modernizr.input.placeholder
$("input[placeholder]").each (index, element)->
unless $(element).val()
$(element).val($(element).attr("placeholder"))
@gscottolson
gscottolson / string.shorten.js
Created Jan 17, 2012
Shorten a long string of HTML to a predetermined length and append with '...'
View string.shorten.js
String.prototype.shorten = function( length ) {
//shorten a string while minding the possible HTML markup within
var original = this.toString()
, length = length || 500
, tagRE = /<\/?\w+(\s+\w+="?[^>]*"?)*\s*>/g
, openTagRE = /<[^>\/]*([^\/]*>)/g
, closeTagRE = /<[\/]([^\/]*>)/g
, pipeRE = /\|/
, tag = ''
, tags = original.match( tagRE )