This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DROP FUNCTION IF EXISTS get_set_data; | |
CREATE OR REPLACE FUNCTION get_set_data(setId integer) | |
RETURNS jsonb AS $$ | |
-- --------------------------------------------- | |
-- Selects set as JSON | |
-- --------------------------------------------- | |
select jsonb_build_object( | |
'set_id', s.id, | |
'set_name', s.name, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DROP FUNCTION IF EXISTS get_family_data; | |
CREATE OR REPLACE FUNCTION get_family_data(familyId integer) | |
RETURNS jsonb AS $$ | |
WITH counts AS ( | |
SELECT | |
f.id AS family_id, | |
COUNT(DISTINCT i.id) AS icons_count, | |
COUNT(DISTINCT il.id) AS illustrations_count, | |
COUNT(DISTINCT s.id) AS sets_count |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This script was taken from a discussion on Google Groups. | |
* I'm not taking credit for it but sharing it because it is very useful for splitting | |
* discontinuous absolute paths into continuous subpaths. Where this is particularly | |
* useful is for importing SVG files into applications like Figma, Sketch, InVision, XD, etc. | |
*/ | |
/** | |
* Split discontinuous absolute paths into continuous sub-paths. | |
* | |
* Example: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This script creates an Adobe Illustrator action, on-the-fly, to export to SVG. The main thing to | |
* understand is that the `name` values in the action code are hexadecimal-encoded strings. The number | |
* that immediately preceeds the encoded name are the length of the hex string divided by 2. | |
* | |
* Usage: | |
* | |
* Change the `basePath` variable to match your file system. This can be set to any folder you like. | |
* | |
* Credits: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* What is going on here? | |
* The Event.dataTransfer object can be set with JavaScript. When the start of a drag event is | |
* detected, we capture the SVG code as a string and set it to the EventTarget.dataTransfer object | |
* as a string. Illustrator handles the rest. | |
*/ | |
/** | |
* Add drag start callback. Add this method to the <img/> element like so: | |
* | |
* <img src="path/to/image.svg" onDragStart="onDragStart" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
/* add this in your settings.json (command + shit +p > Preferences : Open User Settings (JSON) */ | |
{ | |
"editor.tokenColorCustomizations": { | |
"textMateRules": [ | |
{ | |
"name": "storage.type.class.jsdoc", | |
"scope": "storage.type.class.jsdoc,entity.name.type.instance.jsdoc,variable.other.jsdoc", | |
"settings": { | |
"foreground": "#7f848eff" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE accounts( | |
id serial PRIMARY KEY, | |
name VARCHAR(256) NOT NULL | |
); | |
CREATE TABLE entries( | |
id serial PRIMARY KEY, | |
description VARCHAR(1024) NOT NULL, | |
amount NUMERIC(20, 2) NOT NULL CHECK (amount > 0.0), | |
-- Every entry is a credit to one account... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ############################### # | |
# A/B TESTING (START) # | |
# ############################### # | |
# (1) Check if our cookie is already set. | |
# If so, redirect to the previously-viewed page. | |
RewriteCond %{HTTP_COOKIE} ab_test_vers=([^;]+) | |
RewriteRule ^THE-PAGE-BEING-TESTED$ HTTP://YOUR-DOMAIN.COM/tracking/%1 [cookie=ab_test_vers_match:true:YOUR-DOMAIN.COM,L] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const hexToRgb = (hex) => { | |
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex) | |
return result ? { | |
r: parseInt(result[1], 16), | |
g: parseInt(result[2], 16), | |
b: parseInt(result[3], 16) | |
} : null; | |
} | |
module.exports.hexToRgb = hexToRgb; |
NewerOlder