Skip to content

Instantly share code, notes, and snippets.

View noudadrichem's full-sized avatar
💻
Learning the sh*t out of things

Noud noudadrichem

💻
Learning the sh*t out of things
View GitHub Profile
function cleanLayerStyless(array) {
var layers = []
array.forEach(function(layer) {
if (layer.class() == 'MSShapeGroup') layers.push(layer)
})
for (var i = 0; i < layers.length; i++) {
layers.forEach(function(layer, index) {
var fills = layer.style().fills()
fills.forEach(function(fill, fillIndex) {
@noudadrichem
noudadrichem / sketch-plugin-dialog-window.js
Created January 10, 2018 15:31
A function that creates a simple dialog window with CocoaScript
function createDialogWindow(context) {
// Setup the window
var alert = COSAlertWindow.new()
alert.setMessageText("Example modal")
alert.addButtonWithTitle("Run")
alert.addButtonWithTitle("Cancel")
// Create initial view panel
var width = 425
example.sketchPlugin
└── Contents
├── Resources
└── Sketch
├── manifest.json
└── yourFunction.js
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// Choose either "stable" for receiving highly polished,
// or "canary" for less polished but more frequent updates
updateChannel: 'stable',
var selection = context.selection
var shapeGroups = []
function searchInLayer(layer) {
switch (layer.class())) {
case MSPage:
case MSLayerGroup:
case MSArtboardGroup:
let sublayers = layer.layers()
for (let i = 0; i < sublayers.count(); i++) {
secondsToHourMinuteSecond(totalSeconds) {
let hour = Math.floor(totalSeconds / 3600);
let minute = Math.floor(totalSeconds % 3600 / 60);
let seconds = Math.floor(totalSeconds % 3600 % 60);
return `${('0' + hour).slice(-2)}:${('0' + minute).slice(-2)}:${('0' + seconds).slice(-2)}`
}
/*
returns total seconds to hh:mm:ss value.
@noudadrichem
noudadrichem / .editorconfig
Created April 16, 2018 10:56
python editorconfig for atom
root = true
[*.py]
indent_style = tab
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
end_of_line = lf
charset = utf-8
@noudadrichem
noudadrichem / allow-svg-mime-types.php
Created April 28, 2018 07:52
allows SVG mime types in Wordpress, put this snippet in your themes `functions.php` and you're done.
<?php
# mime = meme
function cc_mime_types($memes) {
$memes['svg'] = 'image/svg+xml';
return $memes;
}
add_filter('upload_mimes', 'cc_mime_types');
function fix_svg() {
@noudadrichem
noudadrichem / wp-docker-compose.yml
Last active January 29, 2021 11:03
Wordpress in Docker
version: '2'
services:
wordpress:
depends_on:
- db
image: wordpress:4.7.1
restart: always
volumes:
- ./wp-content:/var/www/html/wp-content
environment:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ANSIBlackColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGKyxYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS
AAGGoKcHCBMZHSQoVSRudWxs1QkKCwwNDg8QERJcTlNDb21wb25lbnRzVU5TUkdCXE5T
Q29sb3JTcGFjZV8QEk5TQ3VzdG9tQ29sb3JTcGFjZVYkY2xhc3NPECgwLjIwNzg0MzEz
NzMgMC4yNDcwNTg4MjM1IDAuMjg2Mjc0NTA5OCAxTxAnMC4xNTc1NDY3NDM4IDAuMTg4