Skip to content

Instantly share code, notes, and snippets.

View rlingineni's full-sized avatar
💭
building cool stuff

Raviteja Lingineni rlingineni

💭
building cool stuff
View GitHub Profile
figma.showUI(`<script>
let imurl = 'https://66.media.tumblr.com/7af65560449c91e8cd82a4a3478f5e0b/tumblr_pb7bt5CTrS1qzdllao1_1280.jpg'
fetch(imurl).then(r => r.arrayBuffer()).then(a =>
parent.postMessage({ pluginMessage: ["imdata", new Uint8Array(a)] }, '*'))
</script>`, { visible:false, width:200, height:200 })
figma.ui.onmessage = msg => {
if (msg[0] == "imdata") {
let data = msg[1] as Uint8Array
let imageHash = figma.createImage(new Uint8Array(data)).hash
const rect = figma.createRectangle()
declare class ReactTrelloBoard<CardMetaData> extends React.Component<ReactTrello.BoardProps<CardMetaData>> {
}
declare module ReactTrello {
/**
* react-trello uses `React.cloneElement`, so these props
* will have to be added to `defaultProps`, otherwise
* TypeScript will (understandably) freak out.
*/
interface NewCardTemplateProps<CardMetaData = object> {
@lynaghk
lynaghk / gist:f6a25748ca748ddb122146eb7e2e3a3c
Created September 25, 2018 16:53
Sketch systems grammar EBNF
<statechart> = (state / <whitespace> / <comments>)+
state = comments? state-name <whitespace>? <newline> block?
transition = comments? event-name <whitespace>? <'->'> <whitespace>? state-name <newline>
<block> = indent (state / transition / <whitespace> / <comments>)+ dedent
comments = comment (<newline> comment)* <newline>
<comment> = <'#'> #".*"
@tonysneed
tonysneed / Mac OS X: Open in Visual Studio Code
Last active March 27, 2024 10:02
Add a command to Finder services in Mac OSX to open a folder in VS Code
- Open Automator
- File -> New -> Service
- Change "Service Receives" to "files or folders" in "Finder"
- Add a "Run Shell Script" action
- Change "Pass input" to "as arguments"
- Paste the following in the shell script box: open -n -b "com.microsoft.VSCode" --args "$*"
- Save it as something like "Open in Visual Studio Code"
@pstoica
pstoica / OnBlurComponent.jsx
Last active August 1, 2023 21:00
onBlur for entire react element
function OnBlurComponent({ onBlur }) {
const handleBlur = (e) => {
const currentTarget = e.currentTarget;
// Check the newly focused element in the next tick of the event loop
setTimeout(() => {
// Check if the new activeElement is a child of the original container
if (!currentTarget.contains(document.activeElement)) {
// You can invoke a callback or add custom logic here
onBlur();