Skip to content

Instantly share code, notes, and snippets.

@josephnle
josephnle / README.md
Last active March 25, 2021 17:59
Figma user macro for Confluence

Figma user macro for Confluence

This user macro is a simple way to embed Figma files using Confluence macros.

The macro accepts 3 parameters:

  • Url: The URL of the Figma file (not embed link!). This value is required and is validated using RegEx. If it is invalid, an error will render.
  • Height: Height of the embed window. Defaults to 450px
  • Width: Width of the embed window. Defaults to 100%.
@chockenberry
chockenberry / finder_icons.sh
Last active February 10, 2024 19:05
A simple shell script to turn the Finders desktop icons on and off
#!/bin/sh
defaults read com.apple.finder CreateDesktop > /dev/null 2>&1
enabled=$?
if [ "$1" = "off" ]; then
if [ $enabled -eq 1 ]; then
defaults write com.apple.finder CreateDesktop false
osascript -e 'tell application "Finder" to quit'
open -a Finder
// Name of layer to copy
var sourceLayerName = "gray_rectangle"
// Ask user to select a Sketch file:
var openDialog = NSOpenPanel.openPanel()
openDialog.setCanChooseFiles(true)
openDialog.setAllowedFileTypes(["sketch"])
openDialog.setCanChooseDirectories(false)
openDialog.setAllowsMultipleSelection(false)
openDialog.setCanCreateDirectories(false)
@robtimp
robtimp / smartquotes.swift
Created May 11, 2015 22:11
Swift smart quotes
// Light-weight Swift smart quote implementation
// By Rob Hudson
// 5/11/2015
import UIKit
let text = "\"Would you tell me, please, which way I ought to go from here?\" " +
"That depends a good deal on where you want to get to,\" said the Cat. " +
"\"I don’t much care where-\" said Alice. " +
"Then it doesn’t matter which way you go,\" said the Cat. " +
@jonpecson
jonpecson / firebase-leaderboard.html
Last active December 16, 2022 12:21
Leaderboard Example (Firebase)
<html>
<head>
<script src="https://cdn.firebase.com/js/client/2.0.4/firebase.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="/resources/tutorial/css/example.css">
</head>
<body>
<div class="example-base example-leaderboard l-demo-container">
<table id="leaderboardTable">
@ngryman
ngryman / without-diatrics.js
Created August 22, 2014 21:33
Strip diatrics from a string.
var withoutDiatrics = function() {
var diatrics = 'ÀÁÂÃÄÅàáâãäåÒÓÔÕÕÖØòóôõöøÈÉÊËèéêëðÇçÐÌÍÎÏìíîïÙÚÛÜùúûüÑñŠšŸÿýŽž';
var stripped = 'AAAAAAaaaaaaOOOOOOOooooooEEEEeeeeeCcDIIIIiiiiUUUUuuuuNnSsYyyZz';
return function(str) {
var len = str.length, out = '';
for (var i = 0; i < len; i++) {
var index = diatrics.indexOf(str[i]);
out += (-1 != index ? stripped[index] : str[i]);
@jstn
jstn / RandomNumbers.swift
Last active May 5, 2023 03:26
generate random numbers for 64-bit types while mitigating modulo bias
/*
`arc4random_uniform` is very useful but limited to `UInt32`.
This defines a generic version of `arc4random` for any type
expressible by an integer literal, and extends some numeric
types with a `random` method that mitigates for modulo bias
in the same manner as `arc4random`.
`lower` is inclusive and `upper` is exclusive, thus: