Skip to content

Instantly share code, notes, and snippets.

View undavide's full-sized avatar

Davide Barranca undavide

View GitHub Profile
@undavide
undavide / lexer.py
Last active April 21, 2021 11:06 — forked from mandiwise/lexer.py
Mostly working JSX lexer for Pygments
# -*- coding: utf-8 -*-
"""
pygments.lexers.jsx
~~~~~~~~~~~~~~~~~~~~
Lexers for JSX formats.
Based on https://github.com/fcurella/jsx-lexer
"""
import re
var gulp = require('gulp');
var clean = require('gulp-clean');
var shell = require('gulp-shell');
// 0. Clean all ZXPs found everywhere
gulp.task('clean-all', function () {
return gulp.src('./**/*.zxp', { read: false })
.pipe(clean());
});
/**
* Generates a Key Byte
* @param {32bit integer} seed e.g. 0xA2791717
* @param {8bit integer} a
* @param {8bit integer} b
* @param {8bit integer} c
* @return {8bit hex string}
*/
function PKV_GetKeyByte(seed, a, b, c) {
var result;
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link id="hostStyle" rel="stylesheet" href="css/theme.css"/>
<link id="theme" rel="stylesheet" href="css/light.css"/>
<title></title>
</head>
<body>
/*jslint vars: true, plusplus: true, devel: true, nomen: true, regexp: true, indent: 4, maxerr: 50 */
/*global $, window, location, CSInterface, SystemPath, themeManager*/
line
(function () {
'use strict';
var csInterface = new CSInterface();
var extensionId = csInterface.getExtensionID();
function PersistentOn() {
@undavide
undavide / javascriptobfuscator.js
Last active February 28, 2019 21:06
JavascriptObfuscator Gulp Plugin
var http = require('http'),
fs = require('fs'),
Readable = require('stream').Readable,
through = require('through2'),
gutil = require('gulp-util'),
Vinyl = require('vinyl');
module.exports = function() {
var transform = function(file, encoding, callback) {
<template>
<div class="spectrum-Dropdown" :class="{ 'is-open': showMenu }" style="width: 240px;">
<button class="spectrum-FieldButton spectrum-Dropdown-trigger is-selected" aria-haspopup="true" @click="toggleMenu">
<span class="spectrum-Dropdown-label">{{ displayedItem }}</span>
<svg class="spectrum-Icon spectrum-UIIcon-ChevronDownMedium spectrum-Dropdown-icon" focusable="false" aria-hidden="true">
<use xlink:href="#spectrum-css-icon-ChevronDownMedium" />
</svg>
</button>
<div class="spectrum-Popover spectrum-Popover--bottom spectrum-Dropdown-popover" :class="{ 'is-open': showMenu }"
@undavide
undavide / find-corrupted-files.sh
Last active May 8, 2018 09:57 — forked from JavierAroche/find-corrupted-files.sh
Find corrupted files using GM identify
folderToCheck='/Volumes/16TB/whatever/path'
outputFile=~/Desktop/FileIntegrity.log
counter=1
Red="\033[0;31m" # Red
Green="\033[0;32m" # Green
Color_Off="\033[0m" # Text Reset
cd "${folderToCheck}"
# Find all files and get count
@undavide
undavide / panels201_4.js
Last active March 14, 2018 21:48
Passing a JSON string from the JSX back to the panel
// JS file (panel)
// ...
csInterface.evalScript('getDocumentInfo()', function(res) {
var resObj = JSON.parse(res);
// you have now access to the same docInfo object
});
// JSX file (Photoshop)
function getDocumentInfo() {
//... I just make up data here...
@undavide
undavide / panels201_3.js
Created March 14, 2018 21:43
Including a callback
// JS file (panel)
// ...
csInterface.evalScript('addSharpeningForWeb(' + paramString + ')', function(res) {
// "res" is the response that comes from Photoshop
});
// JSX file (Photoshop)
function addSharpeningForWeb(paramObj) {
// ... lots of code here
return true;