Skip to content

Instantly share code, notes, and snippets.

View neilrackett's full-sized avatar

Neil Rackett neilrackett

View GitHub Profile
@neilrackett
neilrackett / build.json
Last active May 11, 2020 12:45
Build and run a Cordova iOS app on a device connected to a remote macOS machine using Visual Studio Code Remote Development Extension Pack
{
"ios": {
"debug": {
"codeSignIdentity": "iPhone Developer",
"developmentTeam": "TEAM_ID",
"packageType": "development",
"provisioningProfile": "PROVISIONING_PROFILE_UUID"
},
"release": {
"codeSignIdentity": "iPhone Distribution",
@neilrackett
neilrackett / edit-transform.js
Created February 6, 2018 16:19
Update the X and Y translation values of a CSS transform (e.g. to move an SVG group or object)
let myTransform;
myTransform = "translate(100,200) scale(1)";
myTransform = myTransform.replace(/(.*?translate\()(.*?)(,)(.*?)(\).*)/, (all:string, prefix:string, x:string, comma:string, y:string, suffix:string) =>
{
return `${prefix}${~~x+100}${comma}${~~y+100}${suffix}`;
});
console.log(myTransform); // Output: "translate(200,300) scale(1)"
@neilrackett
neilrackett / php-to-moment.js
Last active December 19, 2024 09:26
Convert PHP date string to Moment.js format
function phpToMoment(str) {
let replacements = {
'd' : 'DD',
'D' : 'ddd',
'j' : 'D',
'l' : 'dddd',
'N' : 'E',
'S' : 'o',
'w' : 'e',
@neilrackett
neilrackett / string-to-ids.js
Created August 9, 2017 16:03
Convert and filter a comma delimited string into an Array of valid ID numbers
// Converts and filters a comma delimited string into an Array of valid database ID numbers, e.g. ",x,1,,0,~,4,5,7" => "1,4,5,7"
let ids = str.split(',').map(keywordId => ~~keywordId).filter(keywordId => keywordId)