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
Regex.Replace("M87.3,41.08v26.68c0,9.08-7.41C79.89,24.61,87.3,32,87.3,41.08z", "([0-9\\.]{0,})", (m) => | |
{ | |
decimal i; | |
if (decimal.TryParse(m.Value, out i)) | |
{ | |
return (i*10).ToString("0.##"); | |
} | |
return m.Value; | |
}, RegexOptions.None) |
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
MIXPANEL_AUTH=my.mp-service-account:MYTOKEN |
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
({event:.event} + (.properties | with_entries(.key |= gsub("\\$"; "")))) | |
| .time |= .-36000 | select(.time>=($day|tonumber) and .time<($day|tonumber+86400)) | |
| .time |= todateiso8601 |
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
#!/usr/bin/env node | |
const path = require('path'); | |
const fs = require('fs'); | |
let iconList = []; | |
function fromDir(startPath, filter, callback) { | |
if (!fs.existsSync(startPath)) { | |
console.warn(`Not a valid directory: ${startPath}`); |
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
Set-Content ".\subscriptions.csv" -Value $null | |
#$subscriptions = [System.Collections.ArrayList]@() | |
Get-ChildItem ".\" -Filter *.json | | |
Foreach-Object { | |
$myJson = Get-Content $_.FullName -Raw | ConvertFrom-Json | |
foreach ($subscription in $myJson.data.subscriptions) { | |
"$($subscription.id),$($subscription.subscriber.email_address)" | Add-Content ".\subscriptions.csv" | |
} | |
} |
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
# instead of event = Stripe::Webhook.construct_event(payload, signature, ENDPOINT_SECRET) | |
data = JSON.parse(payload, symbolize_names: true) | |
event = Stripe::Event.construct_from(data) |
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
function formatXML(xml, tab = ' ', nl = '\n') { | |
let formatted = '', indent = ''; | |
const nodes = xml.slice(1, -1).split(/>\s*</); | |
if (nodes[0][0] == '?') formatted += '<' + nodes.shift() + '>' + nl; | |
for (let i = 0; i < nodes.length; i++) { | |
const node = nodes[i]; | |
if (node[0] == '/') indent = indent.slice(tab.length); // decrease indent | |
formatted += indent + '<' + node + '>' + nl; | |
if (node[0] != '/' && node[node.length - 1] != '/' && node.indexOf('</') == -1) indent += tab; // increase indent | |
} |
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
Abbotsford | |
Aberfeldie | |
Aintree | |
Airport West | |
Albanvale | |
Albert Park | |
Albion | |
Alphington | |
Altona | |
Altona Meadows |
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
class Walk < ApplicationRecord | |
has_many :photos | |
def self.import | |
file = File.read('./walks-in-victoria.json') | |
walks = JSON.parse(file) | |
walks.each do |w| | |
walk = Walk.create(title: w['title'], grade: w['grade'], | |
grade_note: w['gradeNote'], encoded_line: w['encodedLine']) | |
w['images'].each do |image_url| |
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
using HtmlAgilityPack; | |
using Newtonsoft.Json.Linq; | |
using System.IO; | |
using System.Linq; | |
namespace HtmlExtractor | |
{ | |
class Program | |
{ | |
static void Main(string[] args) |
NewerOlder