As configured in my dotfiles.
start new:
tmux
start new with session name:
| // Get the template HTML and remove it from the doument. | |
| var previewNode = document.querySelector("#template"); | |
| previewNode.id = ""; | |
| var previewTemplate = previewNode.parentNode.innerHTML; | |
| previewNode.parentNode.removeChild(previewNode); | |
| var myDropzone = new Dropzone(document.body, { // Make the whole body a dropzone | |
| url: "/target-url", // Set the url | |
| thumbnailWidth: 80, | |
| thumbnailHeight: 80, |
| <!-- HTML heavily inspired by http://blueimp.github.io/jQuery-File-Upload/ --> | |
| <div class="table table-striped" class="files" id="previews"> | |
| <div id="template" class="file-row"> | |
| <!-- This is used as the file preview template --> | |
| <div> | |
| <span class="preview"><img data-dz-thumbnail /></span> | |
| </div> | |
| <div> | |
| <p class="name" data-dz-name></p> |
As configured in my dotfiles.
start new:
tmux
start new with session name:
| { | |
| "name": "project-tools" | |
| , "version": "0.0.1-dev" | |
| , "private": true | |
| , "devDependencies": { | |
| "gulp": "*", | |
| "gulp-myth": "*" | |
| } | |
| } |
| #!/bin/bash | |
| #echo git log $1...$2 --pretty=format:'<li> <a href="http://github.com/jerel/<project>/commit/%H">view commit •</a> %s</li> ' --reverse | grep "#changelog" | |
| firstTag=$(git tag | tail -2 | head -1) | |
| secondTag=$(git tag | tail -1) | |
| cmd=$(basename $0) | |
| if [ "$1" == "-h" ] | |
| then |
| /** | |
| * Preloads the image, and invokes the callback as soon | |
| * as the image is loaded. | |
| */ | |
| var preload = function(src, callback) { | |
| // Create a temporary image. | |
| var img = new Image(); | |
| // Invoke the callback as soon as the image is loaded | |
| // Has to be set **before** the .src attribute. Otherwise |
| Dropzone.myDropzone.options = { | |
| addedfile: function(file) { | |
| file.previewTemplate = $(this.options.previewTemplate); | |
| this.element.find(".previews").append(file.previewTemplate); | |
| file.previewTemplate.find(".filename span").text(file.name); | |
| file.previewTemplate.find(".details").append($("<div class=\"size\">" + (this.filesize(file.size)) + "</div>")); | |
| } | |
| }; |
Is IE8 your new IE6? Level the playing field with polyfills.
This script polyfills addEventListener, removeEventListener, and dispatchEvent. It is less than half a kilobyte minified and gzipped.
addEventListener registers a single event listener on a single target.
| //addEventListener polyfill 1.0 / Eirik Backer / MIT Licence | |
| (function(win, doc){ | |
| if(win.addEventListener)return; //No need to polyfill | |
| function docHijack(p){var old = doc[p];doc[p] = function(v){return addListen(old(v))}} | |
| function addEvent(on, fn, self){ | |
| return (self = this).attachEvent('on' + on, function(e){ | |
| var e = e || win.event; | |
| e.preventDefault = e.preventDefault || function(){e.returnValue = false} | |
| e.stopPropagation = e.stopPropagation || function(){e.cancelBubble = true} |
| var path = require("path"); | |
| exports.media = function(req, res, next) { | |
| var file = req.files.media_upload; | |
| // code to handle file here: | |
| // file should already be in the right location | |
| // The path, this file has been saved at should be: | |
| file.path; | |
| // To get only the filename of this path: |