Skip to content

Instantly share code, notes, and snippets.

View Linrstudio's full-sized avatar
🌴
On vacation

xyz Linrstudio

🌴
On vacation
View GitHub Profile
@sondt87
sondt87 / Android Measure.jsx
Last active August 29, 2015 14:05
Make Annotation and Measurement on PS6 for Android Measurement
/*
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,
@kgiff
kgiff / FontScript.jsx
Created October 22, 2014 14:09
Pull fonts and colors from Photoshop File
// 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(){
@andershaig
andershaig / CSS3_Full.jsx
Created April 17, 2012 21:44
Create CSS3 code from Photoshop layers
/* 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;
@samarpanda
samarpanda / get_css_properties.js
Created September 10, 2015 05:51
Getting all css properties of a dom element in pure javascript
// 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);
@cameronmcefee
cameronmcefee / ApplicationSkin.as
Last active December 11, 2015 11:49
Here's how I detect Photoshop's skin color and set my assets/colors accordingly
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
@puppybits
puppybits / PSD_font_style_ripper.jsx
Last active December 13, 2015 18:49
PSD to CSS web font parser
/*
# 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:
<%
if(page.layout !== 'false'){
%>
<!--渲染-->
<%}else{ %>
<!--不想渲染的页面内容->
<%- page.content %>
<%};%>
@yuanyan
yuanyan / console.js
Last active December 19, 2015 05:09
console API
// 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;")
@Gaubee
Gaubee / WebKit-Style.js
Last active December 19, 2015 17:49
write all element's style in the prototye of style. 将元素所有的样式写到style中,方便单文件复制。 mhtml的保存并不完整。
(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);
@wintercn
wintercn / adhocSort.js
Created September 30, 2013 03:19
假期前小玩意,ad-hoc排序
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++)