Skip to content

Instantly share code, notes, and snippets.

Avatar

Vladimir Carrer vladocar

View GitHub Profile
View gist:984cf5be4f511a3351526e97a2291522
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
View Writability
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 Jun 11, 2012
URL to QR Bookmarklet - JavaScript
View 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 Jun 10, 2012
URL to QR Bookmarklet - jQuery
View 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 Jan 17, 2012
Number of Layers in Photoshop
View layerNumber.js
var layerNum = app.activeDocument.layers.length;
prompt("Layers Number:", layerNum);
@vladocar
vladocar / layerNames.js
Created Jan 17, 2012
Layer names list in Photoshop
View layerNames.js
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 Jan 17, 2012
Order Layers Alphabetically in Photoshop
View layersOrder.js
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 Jan 17, 2012
Layer Duplicates in Photoshop
View layerDuplicates.js
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 Nov 3, 2011
Make Guides Grid with number of guides in Photoshop CS5
View NumberGuidesGrid.js
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 Nov 3, 2011
Make Guides Grid with units in Photoshop CS5
View GuidesUnitGrid.js
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);