This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Pixel Measure v0.04 - Photoshop script for adding android measurements to your mockups | |
Copyright (C) 2014 Son Duong Thanh | |
This program is free software; you can redistribute it and/or | |
modify it under the terms of the GNU General Public License | |
as published by the Free Software Foundation; either version 2 | |
of the License, or (at your option) any later version. | |
This program is distributed in the hope that it will be useful, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Script to pull fonts from Photoshop document adapted from: | |
// http://graphicdesign.stackexchange.com/questions/24727/how-to-export-font-information-for-a-specific-psd-file-for-use-in-writing-css | |
var TextLayers = [], | |
arFonts = {}, | |
arColors = {}, | |
arSizes = {}, | |
arLeading = {}; | |
function run(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Copyright 2012 - Minim Group - http://minim.co/ */ | |
// Enable double-clicking from Finder/Explorer | |
#target photoshop | |
app.bringToFront(); | |
// ### Document Variables | |
var doc_layers = app.activeDocument.layers; | |
var num_layers = doc_layers.length; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Got from this url: http://acuriousanimal.com/blog/2012/07/09/look-mom-no-jquery-getting-all-css-properties-of-a-dom-element-in-pure-javascript/ | |
function getComputedStyle( dom ) { | |
var style; | |
var returns = {}; | |
// FireFox and Chrome way | |
if(window.getComputedStyle){ | |
style = window.getComputedStyle(dom, null); | |
for(var i = 0, l = style.length; i < l; i++){ | |
var prop = style[i]; | |
var val = style.getPropertyValue(prop); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package classes { | |
public class ApplicationSkin { | |
import com.adobe.csxs.core.CSXSInterface; | |
import com.adobe.csxs.types.AppSkinInfo; | |
public function ApplicationSkin() {} | |
// The current lightness of the app's background on a scale of 0-1 | |
// | |
// Returns a Number |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
# Create customized Web Fonts CSS file from a folder of PSDs | |
1. Edit the root location for the font. | |
2. Add any mapping you might need/want from Desktop fonts to the webfonts. | |
3. In Photoshop go to File > Scripts > Browse... and select the fonts.jsx file | |
4. Select the Folder where you PSDs are. | |
5. Photoshop scripting is very slow, so wait for it to complete and save a fonts.css file to the location. | |
## Sample file created: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% | |
if(page.layout !== 'false'){ | |
%> | |
<!--渲染--> | |
<%}else{ %> | |
<!--不想渲染的页面内容-> | |
<%- page.content %> | |
<%};%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://getfirebug.com/wiki/index.php/Console_API | |
// https://developers.google.com/chrome-developer-tools/docs/console-api#consolelogobject_object | |
// https://developer.mozilla.org/en-US/docs/Web/API/console | |
console.log("%cRed text, %cgreen text, %cblue text", "color:red", "color:green", "color:blue"); | |
console.log("%c", | |
"font-size: 1px; padding: 130px 232px; line-height: 260px;background: url(http://i.imgur.com/oGiMR.gif); background-size: 464px 260px; color: transparent;") | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (G) { | |
function simpleDOM(tagName){ | |
var dom = document.createElement(tagName); | |
document.body.appendChild(dom); | |
return dom; | |
} | |
function getDifStyle(el){ | |
var baseDOM = simpleDOM(el.tagName); | |
var elStyle = getComputedStyle(el); | |
var baseDOMStyle = getComputedStyle(baseDOM); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function shuffle(array){ | |
for(var i = array.length-1; i > 0; i--) { | |
var rnd = Math.floor(Math.random() * (i+1)); | |
var tmp = array[i]; | |
array[i] = array[rnd]; | |
array[rnd] = tmp; | |
} | |
} | |
function isInOrder(array) { | |
for(var i = 0; i < array.length-1; i++) |
OlderNewer