Skip to content

Instantly share code, notes, and snippets.

@mikeeus
mikeeus / renew-gpgkey.md
Created February 1, 2024 15:37 — forked from krisleech/renew-gpgkey.md
Renew Expired GPG key

Renew GPG key

Given that your key has expired.

$ gpg --list-keys
$ gpg --edit-key KEYID

Use the expire command to set a new expire date:

// Sources flattened with hardhat v2.9.8 https://hardhat.org
// File hardhat/console.sol@v2.9.8
// SPDX-License-Identifier: MIT
pragma solidity >= 0.4.22 <0.9.0;
library console {
address constant CONSOLE_ADDRESS = address(0x000000000000000000636F6e736F6c652e6c6f67);
const GB_BUY={availableWindows:[],loadAvailableWindows:()=>{const t=encodeURIComponent(window.CART_COLLECTIONS.filter((t,e)=>window.CART_COLLECTIONS.indexOf(t)===e).join(",")),e=Shopify.shop.replace(".myshopify.com","");fetch(`https://grocerbox.ngrok.io/shopify/private_shops/${encodeURIComponent(e)}/available_windows?collections=${t}&window_count=30`,{method:"GET",mode:"cors",cache:"no-cache"}).then(t=>t.json()).then(t=>{GB_BUY.availableWindows=t.map(t=>{const[e,n,a]=t.date.split("-"),i=new Date(e,parseInt(n,10)-1,a);return{window:t,code:t.code,day:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][i.getDay()],month:["January","February","March","April","May","June","July","August","September","October","November","December"][i.getMonth()],date:i.getDate(),name:t.name}})})},initializeTimeSlots:t=>{const e=t.model.customAttributes.filter(({key:t})=>"Date"===t)[0],n=t.model.customAttributes.filter(({key:t})=>"code"===t)[0],a=t.model.customAttributes.filter(({key:t})=>"window"===t)[0];let i
class Class
def initialize
end
end
@mikeeus
mikeeus / rails-jsonb-queries
Created January 13, 2021 20:56 — forked from mankind/rails-jsonb-queries
Rails-5 postgresql-9.6 jsonb queries
http://stackoverflow.com/questions/22667401/postgres-json-data-type-rails-query
http://stackoverflow.com/questions/40702813/query-on-postgres-json-array-field-in-rails
#payload: [{"kind"=>"person"}]
Segment.where("payload @> ?", [{kind: "person"}].to_json)
#data: {"interest"=>["music", "movies", "programming"]}
Segment.where("data @> ?", {"interest": ["music", "movies", "programming"]}.to_json)
Segment.where("data #>> '{interest, 1}' = 'movies' ")
Segment.where("jsonb_array_length(data->'interest') > 1")
@mikeeus
mikeeus / gist:7d8ac026009c67625b79db07c6a32130
Created June 13, 2018 11:01
Common variables for Sass projects
/**
* Media Query variables and mixins
* Example:
* p {
* font-size: 16px;
*
* @include xs {
* font-size: 18px;
* }
*
@mikeeus
mikeeus / prepare_lucky_instance
Last active January 21, 2018 10:58
Script to prepare a Google Compute Engine instance for Crytsal-lang and Lucky with Nginx, Certbot and a local Postgresql + Postgis db.
#!/bin/sh
# Exit if any subcommand fails
set -e
POSTGRES_USER=$USER
# Install posgresql
# Optional. You may want to use an external database.
sudo apt-get update
@mikeeus
mikeeus / gh-comments.js
Created December 15, 2017 05:23
Github Issue Comments
// Credit to Orta Therox for this: https://github.com/artsy/artsy.github.io/blob/source/_includes/gh_comments.html
// Comes from https://stackoverflow.com/questions/3177836/how-to-format-time-since-xxx-e-g-4-minutes-ago-similar-to-stack-exchange-site
function timeSince(date) {
var seconds = Math.floor((new Date() - date) / 1000)
var interval = Math.floor(seconds / 31536000)
if (interval > 1) {
return interval + " years"
}
interval = Math.floor(seconds / 2592000)