Skip to content

Instantly share code, notes, and snippets.

View freekrai's full-sized avatar

Roger Stringer freekrai

View GitHub Profile
@freekrai
freekrai / Readme.md
Last active September 29, 2024 16:02 — forked from AceCodePt/hx-astro-view-transition.js
htmx-astro-view-transition

Add it to the body

<body hx-ext="hx-astro-view-transition">

An example

@freekrai
freekrai / browser-mockup.png
Created March 31, 2021 18:05 — forked from jarthod/browser-mockup.png
Pure CSS browser mockups
browser-mockup.png
@freekrai
freekrai / .zshrc
Created November 17, 2020 16:27 — forked from callumlocke/.zshrc
ZSH function to auto-switch to correct Node version
####
# ZSH function to auto-switch to correct Node version
# https://gist.github.com/callumlocke/30990e247e52ab6ac1aa98e5f0e5bbf5
#
# - Searches up your directory tree for the closest .nvmrc, just like `nvm use` does.
#
# - If you are already on the right Node version, IT DOES NOTHING, AND PRINTS NOTHING.
#
# - Works correctly if your .nvmrc file contains something relaxed/generic,
# like "4" or "v12.0" or "stable".
@freekrai
freekrai / Tab.css
Last active February 22, 2018 16:44 — forked from diegocasmo/Tab.js
Source code for implementing a React <Tabs/> component.
ul.tabs-nav.nav.navbar-nav.navbar-left {
margin: 0px;
padding: 0px;
list-style: none;
}
li.tab {
display: inline-block;
padding: 10px;
margin-right: 5px;
@freekrai
freekrai / Procfile
Created February 16, 2018 21:30 — forked from jordansissel/Procfile
Jenkins on Heroku
# Only listen on http; disable ajp and https
web: java -jar jenkins.war --httpPort=$PORT --ajp13Port=-1 --httpsPort=-1
@freekrai
freekrai / examples.md
Created June 25, 2017 15:32 — forked from ErisDS/examples.md
Ghost Filter Query examples

Filter Queries - Example Use Cases

Here are a few example use cases, these use cases combine filter with other parameters to make useful API queries. The syntax for any of this may change between now, implementation, and release - they're meant as illustrative examples :)

Fetch 3 posts with tags which match 'photo' or 'video' and aren't the post with id 5.

api.posts.browse({filter: "tags:[photo, video] + id:-5", limit="3"});

GET /api/posts?filter=tags%3A%5Bphoto%2Cvideo%5D%2Bid%3A-5&limit=3

#!/bin/bash
# remove exited containers:
docker ps --filter status=dead --filter status=exited -aq | xargs -r docker rm -v
# remove unused images:
docker images --no-trunc | grep '<none>' | awk '{ print $3 }' | xargs -r docker rmi
# remove unused volumes:
find '/var/lib/docker/volumes/' -mindepth 1 -maxdepth 1 -type d | grep -vFf <(
@freekrai
freekrai / not-bad-code.js
Created January 30, 2016 17:06 — forked from domenic/not-bad-code.js
Avoiding explicit promise construction antipattern
function getUserDetail(username) {
if (userCache[username]) {
return Promise.resolve(userCache[username]);
}
// Use the fetch API to get the information
return fetch('users/' + username + '.json')
.then(function(result) {
userCache[username] = result;
return result;
@freekrai
freekrai / elb-nodejs-ws.md
Created December 29, 2015 00:41 — forked from obolton/elb-nodejs-ws.md
Configuring an AWS Elastic Load Balancer for a Node.js application using WebSockets on EC2

AWS ELB with Node.js and WebSockets

This assumes that:

  • You are using Nginx.
  • You want to accept incoming connections on port 80.
  • Your Node.js app is listening on port 3000.
  • You want to be able to connect to your Node.js instance directly as well as via the load balancer.

####1. Create load balancer

@freekrai
freekrai / google-inbox-userscript.js
Created December 8, 2015 05:41 — forked from aaronn/google-inbox-userscript.js
Google Inbox for Desktop (Fluid Userscript)
/* This is a FluidApp userscript for Google Inbox for Mac.
Includes options for total badge count and unread badge count.
1) You need the paid version of FluidApp (http://fluidapp.com/)
2) Point Fluid to https://inbox.google.com (I recommend the icon from here: https://medium.com/@chrismessina/create-an-icon-for-google-inbox-in-your-dock-ed269312e3bc)
3) Set the user-agent to Chrome
4) Go to window -> userscript and add click the plus sign under the first table (on the left). Name the item 'Inbox'.
5) In the second table (on the right) click the plus and type in "*inbox.google.com*".
6) Paste the contents of this document into the script area below that.
7) Configure badge count (for total or unread only) in the code below.