Skip to content

Instantly share code, notes, and snippets.

View vladocar's full-sized avatar

Vladimir Carrer vladocar

View GitHub Profile
text: 4 | 4 | 4
code: <div class="four"> </div> <div class="four"> </div> <div class="four"> </div>
text: 3 | 3 | 3 | 3
code: <div class="three"> </div> <div class="three"> </div> <div class="three"> </div> <div class="three"> </div>
text: 2 | 2 | 2 | 6
code: <div class="two"> </div> <div class="two"> </div> <div class="two"> </div> <div class="six">
text: 3 | 2 | 4 | 3
data:text/html;charset=utf-8, <title>Writability</title><body OnLoad='document.body.focus();' contenteditable style="font-size:21px;line-height:1.6;font-family:'Chaparral Pro',Georgia;max-width:21em;margin:0 auto;padding:3rem;background-color:rgb(233,233,225);color:rgb(68,68,68);" spellcheck="false">
@vladocar
vladocar / URL to QR Bookmarklet - JavaScript
Created June 11, 2012 12:40
URL to QR Bookmarklet - JavaScript
document.getElementsByTagName("body")[0].innerHTML="<div id='qrcode' style='position:absolute; top:0; left:0; z-index:99993; width:550px; height:550px;background-color:#fff; padding:49px; border:1px solid #ccc'><img src='http://chart.apis.google.com/chart?cht=qr&chs=500x500&choe=UTF-8&chld=H&chl="+window.location+"' /></div>"
@vladocar
vladocar / URL to QR Bookmarklet - jQuery
Created June 10, 2012 22:23
URL to QR Bookmarklet - jQuery
$("body").append("<div id='qrcode' style='position:absolute; top:0; left:0; z-index:99993; width:550px; height:550px;background-color:#fff; padding:49px; border:1px solid #ccc'><img src='http://chart.apis.google.com/chart?cht=qr&chs=500x500&choe=UTF-8&chld=H&chl="+window.location+"' /></div>");
@vladocar
vladocar / layerNumber.js
Created January 17, 2012 21:18
Number of Layers in Photoshop
var layerNum = app.activeDocument.layers.length;
prompt("Layers Number:", layerNum);
@vladocar
vladocar / layerNames.js
Created January 17, 2012 21:16
Layer names list in Photoshop
var layerNum = app.activeDocument.layers.length;
var a = [];
for (var i = 0; i < layerNum; i++) {
a[i] = '"' + app.activeDocument.layers[i].name + '"';
}
prompt("Layers Names:", a);
@vladocar
vladocar / layersOrder.js
Created January 17, 2012 21:08
Order Layers Alphabetically in Photoshop
var layers = activeDocument.layers;
var layersArray = [];
var len = layers.length;
// store all layers in an array
for (var i = 0; i < len; i++) {
layersArray.push(layers[i]);
}
@vladocar
vladocar / layerDuplicates.js
Created January 17, 2012 21:04
Layer Duplicates in Photoshop
var layerNum = app.activeDocument.layers.length;
var arr = [];
for (var i = 0; i < layerNum; i++) {
arr[i] = '"'+app.activeDocument.layers[i].name+'"';
}
// taken from: http://stackoverflow.com/questions/840781/easiest-way-to-find-duplicate-values-in-a-javascript-array
var sorted_arr = arr.sort(); // You can define the comparing function here.
@vladocar
vladocar / NumberGuidesGrid.js
Created November 3, 2011 03:54
Make Guides Grid with number of guides in Photoshop CS5
var doc = app.activeDocument;
var guides = app.activeDocument.guides;
var w = doc.width;
var h = doc.height;
function MakeGuidesGrid(numVerticalGuides, gutterVertical, numHorisontalGuides, gutterHorisontal) {
if (numHorisontalGuides !== 0) {
var j = h / numHorisontalGuides;
for (var i = 0; i < numHorisontalGuides; i++) {
guides.add(Direction.HORIZONTAL, j * i);
@vladocar
vladocar / GuidesUnitGrid.js
Created November 3, 2011 03:50
Make Guides Grid with units in Photoshop CS5
var doc = app.activeDocument;
var guides = app.activeDocument.guides;
var w = doc.width;
var h = doc.height;
function MakeGuidesGrid(unitVertical, gutterVertical, unitHorisontal, gutterHorisontal) {
if (unitHorisontal !== 0) {
var j = h / unitHorisontal;
for (var i = 0; i < j; i++) {
guides.add(Direction.HORIZONTAL, i * unitHorisontal);