Skip to content

Instantly share code, notes, and snippets.

View ricardocasares's full-sized avatar
🚀

Ricardo Casares ricardocasares

🚀
View GitHub Profile
@ricardocasares
ricardocasares / loadgtfs.cql
Created April 17, 2024 22:45 — forked from rvanbruggen/loadgtfs.cql
Loading and Querying GTFS data
//LOAD CSV script for GFTS data
create constraint on (a:Agency) assert a.id is unique;
create constraint on (r:Route) assert r.id is unique;
create constraint on (t:Trip) assert t.id is unique;
create index on :Trip(service_id);
create constraint on (s:Stop) assert s.id is unique;
create index on :Stoptime(stop_sequence);
create index on :Stop(name);
schema await
@ricardocasares
ricardocasares / idempotent_script.sql
Created November 7, 2023 21:25 — forked from michelmilezzi/idempotent_script.sql
A simple script demonstrating PostgreSQL idempotent capabilities. You can run this script as many times as you wish (it will not give duplicate object error or similar).
--Table
CREATE TABLE IF NOT EXISTS person (
id integer NOT NULL,
person_name character varying(40) NOT NULL,
updated_date date,
CONSTRAINT person_pkey PRIMARY KEY (id)
);
--Index
CREATE INDEX IF NOT EXISTS idx_person_name ON person (person_name);
@ricardocasares
ricardocasares / query.js
Created August 4, 2023 10:43
aggregate by highest semver
db.getCollection("versioned").aggregate(
[
{ $sort: { __version: -1 }},
{ $group: { _id: "$UUID", doc: { $first: "$$ROOT" }}},
{ $replaceWith: "$doc" }
],
{ collation: { locale: 'en', numericOrdering: true }}
)
@ricardocasares
ricardocasares / free_rooms_groq.js
Last active December 1, 2022 23:17
GROQ Queries
export const FREE_ROOMS = groq`
*[_type == 'room' && count(*[_type == 'booking' && ^._id in room[]._ref && ((checkin >= $ci && checkin <= $co)||(checkin <= $ci && checkout >= $ci))]) == 0]{...}
`;
{
"meta": {
"theme": "professional"
},
"basics": {
"name": "Ricardo Casares",
"label": "Full Stack Human",
"email": "[email protected]",
"phone": "",
"summary": "A web craftsman, passionate about the Internet and new technologies.",
@ricardocasares
ricardocasares / resolver.ts
Last active August 29, 2018 09:09
Resolve redux initial route data
import * as Pattern from "url-pattern";
import { Dispatch, Middleware } from "redux";
export interface Options {
actions: string[];
routes: {
[x: string]: (store: Dispatch, params: any) => any;
};
}
@ricardocasares
ricardocasares / what-forces-layout.md
Created June 13, 2016 23:41 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@ricardocasares
ricardocasares / notifyOwnChanges.groovy
Last active November 21, 2018 20:00
Bulk profile update for JIRA users from Groovy script on script-runner plugin.
/**
* This script was succesfuly tested on JIRA 6.1
*/
// import JIRA Component Accessor
import com.atlassian.jira.component.ComponentAccessor
// Create a new instance
cA = new ComponentAccessor();
// Get all application users
users = cA.getUserManager().getAllApplicationUsers();