Skip to content

Instantly share code, notes, and snippets.

SVGify

Compiles a directory of svgs into a js file of base64 pngs which can be accessed from window.svgs.

###Usage:

  • Put svgify into your directory of svgs, and run it with node svgify.js.
  • Include the resulting svgs.js in your page
  • Insert images like: <img data-src-svg='#{filename-without-extension}' />
  • Add replaceSvgs.js to your page.
@latentflip
latentflip / lesson.md
Created September 2, 2013 10:24 — forked from tef/lesson.md

I hate markdown

  1. Here is a list. I can do numbered lists.

  2. I can do a list entry followed by two spaces.
    This means this is in the same paragraph

  3. If I want a code block (with syntax highlighting, inside a list, something breaks:

@latentflip
latentflip / scout.js
Last active December 19, 2015 15:09
Scoutfile used at Float developed around the concepts presented in @SlexAxton's post: http://alexsexton.com/blog/2013/03/deploying-javascript-applications/
// ScoutFile - MIT (c) @philip_roberts
// This file should be as close to the top of you html as possible, and be cached for
// a short time.
//
// The configurable section should define a `loadScripts` function
// which uses addCssTag and addScriptTag to load in the required
// scripts. loadScripts should also call onScriptsLoaded when it's
// imported all the scripts it needs (probably in the addScriptTag onDone callback).
//
// addCssTag(url) - injects the css file at url into the page

Rough outline of asset deployment strategy

Goals

  • Separate front end "client" deployment and build process from backend deployment.
  • Not necessarily have to create two completely distinct applications (because of authentication difficulties etc), but could go in that direction if needed.
  • Migratable to from the asset pipeline & compatible with rails.
  • Support coffeescript, sass compilation.
  • Allow lightweight "staging" clients to be deployed using the existing backend. Ideally even use the production backend with a development client.
  • Fast compilation and deployment.
@latentflip
latentflip / 0_readme.md
Last active December 18, 2015 14:48
Unbreak rbs online.
@latentflip
latentflip / gist:5748310
Created June 10, 2013 12:16
Testing Puts
class MyClass
def initialize(word)
@word = word
end
def putter
puts @word
end
end
describe "MyClass" do
<!DOCTYPE html>
<head>
<script src="http://d3js.org/d3.v3.min.js"></script>
<style>
svg circle {
fill: #D0002A;
}
</style>
</head>
$input.focus ->
_.defer -> $input.select()
arrow = $("<a href='#'>").text("➡").attr(tabindex: -1)
arrow.css({display: 'block', position: 'absolute', top: 4, right: -19, zIndex: 5, fontSize: 20})
arrow.insertAfter $input
arrow.mousedown (ev) ->
ev && (ev.preventDefault() || ev.stopPropagation)
budgetEntry.save({ modify_future_events: true }, { success: -> budgetEntry.set({modify_future_events: false}) })
map <leader>m :call ToggleRnu()<CR>
function! ToggleRnu()
if &rnu
set number
else
set rnu
end
endfunction