Skip to content

Instantly share code, notes, and snippets.

@patrykkalinowski
patrykkalinowski / savetiles.js
Created August 29, 2023 08:57
Code to save slippy map tiles to indexedDB as blobs. Uses Dexie
function lon2tile(lon,zoom) {
return (Math.floor((lon+180)/360*Math.pow(2,zoom)))
}
function lat2tile(lat,zoom) {
return (Math.floor((1-Math.log(Math.tan(lat*Math.PI/180) + 1/Math.cos(lat*Math.PI/180))/Math.PI)/2 *Math.pow(2,zoom)))
}
async function downloadTile(zoom, column, tile) {
let row = await db.tiles.get({
require 'rest-client'
require 'json'
properties = File.open('./hubspot-contact-properties-list-shortened.txt')
request = "http://api.hubapi.com/contacts/v1/lists/all/contacts/all?hapikey=APIKEY&showListMemberships=true&formSubmissionMode=all&count=1000"
properties.each do |property|
request << "&property=#{property}"
end
Inbound Contacts
Includes
Rule 1
Rule 2
Rule n
Excludes
Rule 1
Rule 2
Rule n
<form action="http://example.com/search">
<input type="search" name="q" placeholder="Search">
</form>
{# you can replace 'default' with your blog id #}
{% set contents = blog_popular_posts('default', 200) %}
{# search query #}
{% set query = request.query_dict['q'] %}
<h1>Search results for: {{ query }}</h1>
{% for content in contents %}
{% if query|lower in content.name|lower %}
{# your blogpost listing, ex. <h2>{{ content.name }}</h2> #}
<div style="display: none;">
<script type="text/javascript" src="//your.mautic.domain/form/generate.js?id=1"></script>
</div>
<script>
jQuery("input#billing_email").change(function() {
var customer_email = jQuery("input#billing_email").val();
jQuery("input#mauticform_input_yourformname_email").val(customer_email)
jQuery("form#mauticform_yourformname").submit();
})
{
"uid": "1VOa"
}
response:
{
code: 200
status: "Beacon recognized"
name: "Czarny"
if trial?
scheduler = Rufus::Scheduler.new
date = Date.today
scheduler.in '10d' do
trial = Trial.new(customer[:id], customer[:name], date)
trial.check_activity
end
end
class Trial
def check_activity
if activity > 100
send_mail(Mailer)
end
end
def send_mail(mail)
mail.new(id, name, date, total_activity)
end
date = Date.today
scheduler.in '10d' do
something = Something.new(date)
end