Skip to content

Instantly share code, notes, and snippets.

View emalgholzad's full-sized avatar

Emal emalgholzad

View GitHub Profile

Shared project instructions

This is the canonical instruction file for every coding agent working in this repository, including Codex and Claude Code. Keep project-wide knowledge here. CLAUDE.md is only a Claude Code entry point that imports this file; do not duplicate shared instructions there.

Start here

Before changing code:

@emalgholzad
emalgholzad / dance.js
Created September 4, 2019 09:09 — forked from wesbos/dance.js
// 1. Visit a news website like cnn.com
// 2. paste this into your console
setInterval(() =>
document.querySelectorAll('p,img,a,button,h1,h2,h3,span')
.forEach(x=>x.style=`transform:rotate(${Math.random()*777}deg) scale(${Math.random()* 3}); transition:all .5s`)
, 500);
// 3. feel a lil bit better 😘
@emalgholzad
emalgholzad / async-await.js
Created September 3, 2019 15:18 — forked from wesbos/async-await.js
Simple Async/Await Example
// 🔥 Node 7.6 has async/await! Here is a quick run down on how async/await works
const axios = require('axios'); // promised based requests - like fetch()
function getCoffee() {
return new Promise(resolve => {
setTimeout(() => resolve('☕'), 2000); // it takes 2 seconds to make coffee
});
}
@emalgholzad
emalgholzad / EsLint.js
Created June 20, 2018 13:33
ESLint disable line and block
// eslint-disable-line
/* eslint-disable no-alert, no-console */
/* eslint-disable */
alert('foo');
/* eslint-enable */
// eslint-disable-line no-use-before-define
@emalgholzad
emalgholzad / sketchCheats.js
Last active June 20, 2018 12:20
Sketch plugin development cheat sheet
// NEW API
const sketch = require('sketch');
const document = sketch.getSelectedDocument();
const selection = document.selectedLayers;
const layerSelected = selection.layers[0];
const style = layerSelected.style;
const borders = style.borders;
// OLD API
const doc = context.document;
@emalgholzad
emalgholzad / debug.js
Created June 7, 2018 15:48
Debug for profiling and logging
var debug = debug || {};
debug = {
on : false,
startTime: 0,
partialTime: 0,
// start the profiling
start : function(){
debug.on = true;
startTime = Date.now();
partialTime = Date.now();
@emalgholzad
emalgholzad / layer.js
Created June 7, 2018 13:36
Sketch API layer class type
// Old way
export const LAYERTYPES = {
symbol: {
master: 'MSSymbolMaster',
instance: 'MSSymbolInstance',
},
artboard: 'MSArtboardGroup',
text: 'MSTextLayer',
group: 'MSLayerGroup',
shape: 'MSShapeGroup',
const COLOR = {
keys: {
gray: 'gray',
ultraLight: 'ultra-light',
veryLight: 'very-light',
bright: 'bright',
veryDark: 'very-dark',
veryDarkGray: 'very-dark-gray',
},
ranges: [
@emalgholzad
emalgholzad / outline-bemit.css
Created April 24, 2018 08:00
Outline BEMIT
/**
* Outline all classes.
*/
[class] {
outline: 5px solid lightgrey;
}
/**
* Outline all BEM Elements.
*/
@emalgholzad
emalgholzad / remove-remote-local-tags.sh
Created April 16, 2018 14:09 — forked from okunishinishi/Remove all git tags
Delete all git remote tags (remote and local)
#Delete local tags.
git tag -l | xargs git tag -d
#Fetch remote tags.
git fetch
#Delete remote tags.
git tag -l | xargs -n 1 git push --delete origin
#Delete local tasg.
git tag -l | xargs git tag -d