Skip to content

Instantly share code, notes, and snippets.

View alvincrespo's full-sized avatar
:shipit:
Shipping Code.

Alvin Crespo alvincrespo

:shipit:
Shipping Code.
View GitHub Profile
@alvincrespo
alvincrespo / gatsby-migrate.sh
Created March 7, 2024 11:23
Gatsby -> Bridgetown
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'fileutils'
# Define your source and destination directories
source_dir = 'content/blog'
posts_destination_dir = 'src/_posts'
images_destination_dir = 'src/images'
@alvincrespo
alvincrespo / update-node-version
Last active January 16, 2024 13:23
Updates your node version across files (package.json, .node-version and circleci/config.yml)
#!/bin/bash
# Load NODE_VERSION from .env file
export $(grep NODE_VERSION .env | xargs)
# Check if NODE_VERSION is set
if [ -z "$NODE_VERSION" ]; then
echo "NODE_VERSION is not set in .env file."
exit 1
fi
@alvincrespo
alvincrespo / application_helper.rb
Created July 21, 2022 11:02
TailwindUI + will_paginate renderer
module ApplicationHelper
def will_paginate(coll_or_options = nil, options = {})
if coll_or_options.is_a? Hash
options = coll_or_options
coll_or_options = nil
end
options = options.merge renderer: TailwindUIPaginationRenderer unless options[:renderer]
super(*[coll_or_options, options].compact)
end
end
@alvincrespo
alvincrespo / chart_controller.js
Last active January 1, 2022 18:30
Chart.js Controller for Rails
/*
* Template Usage
* <div data-controller="chart">
* <canvas id="element" width="400" height="400"></canvas>
* </div>
*
*/
/*
* Sample Data Structure
@alvincrespo
alvincrespo / bison.log
Last active September 29, 2020 14:51
Bison Install Error
//-------------------------------------------------------------------------------------------------------------------------
➜ Desktop node -v
v12.18.2
➜ Desktop npm -v
6.14.5
➜ Desktop yarn -v
1.22.4
//-------------------------------------------------------------------------------------------------------------------------
@alvincrespo
alvincrespo / config.yml
Created April 28, 2019 17:19
Workflow Sample for CircleCI
workflows:
version: 2
test_and_release:
jobs:
- build
- release:
requires:
- build
@alvincrespo
alvincrespo / config.yml
Created April 28, 2019 17:17
Sample Job with Executor
jobs:
build:
executor: my-executor
steps:
- checkout
- restore_cache:
keys:
- v2-deps-{{ .Branch }}-{{ checksum "package-lock.json" }}
- v2-deps-{{ .Branch }}-
- v2-deps-
@alvincrespo
alvincrespo / config.yml
Created April 28, 2019 17:15
Sample Executor
executors:
my-executor:
docker:
- image: cypress/base:8
environment:
TERM: xterm
working_directory: ~/app
@alvincrespo
alvincrespo / config.yml
Created April 28, 2019 16:50
Reusing Configuration across Jobs in CircleCI 2.1
version: 2.1
executors:
my-executor:
docker:
- image: cypress/base:8
environment:
TERM: xterm
working_directory: ~/app
@alvincrespo
alvincrespo / keybindings.json
Created March 2, 2018 14:20
Move focus between your editor and integrated terminal in VSCode
[
{
"key": "ctrl+`",
"command": "workbench.action.terminal.focus"
},
{
"key": "ctrl+`",
"command": "workbench.action.focusActiveEditorGroup",
"when": "terminalFocus"
}