Skip to content

Instantly share code, notes, and snippets.

View thestephenmarshall's full-sized avatar

Stephen Marshall thestephenmarshall

View GitHub Profile
@thestephenmarshall
thestephenmarshall / webpack-to-vite-rails.md
Last active February 2, 2024 21:13
Moving from Webpacker to Vite in a Rails Application

Migrating from Webpacker to Vite

Since Webpacker is used in Rails apps, you would want not only to add vite from NPM, but also the ancillary dependencies.

Easiest Way to Get Started

The easiest way to do this is to 1) add the vite_ruby gem to your Gemfile or gemspec, then run bundle, then 2) run bundle exec vite install. /This will take care of adding the other dependencies needed to get started./

Results

Following the above steps will do these things for your app:

Keybase proof

I hereby claim:

  • I am thatjsguy on github.
  • I am themarshall (https://keybase.io/themarshall) on keybase.
  • I have a public key ASAt10K6jzS4ZlyIAYau7D0iRNvVMfYyHYuidFN8AAYCOQo

To claim this, I am signing this object:

@thestephenmarshall
thestephenmarshall / autoload.sh
Created February 9, 2018 17:35
Autoload nvmrc
# NVM
autoload -U add-zsh-hook
load-nvmrc() {
if [[ -f .nvmrc && -r .nvmrc ]]; then
nvm use
fi
}
add-zsh-hook chpwd load-nvmrc
@thestephenmarshall
thestephenmarshall / structure.sql.diff
Created June 16, 2017 15:43
Structure.sql - diff master
diff --git a/components/nitro_component_transition/spec/dummy/db/structure.sql b/components/nitro_component_transition/spec/dummy/db/structure.sql
index 7e6c8478f5..3cbf5374f0 100644
--- a/components/nitro_component_transition/spec/dummy/db/structure.sql
+++ b/components/nitro_component_transition/spec/dummy/db/structure.sql
@@ -5104,7 +5104,6 @@ CREATE TABLE `nitro_component_transition_pto_hours` (
KEY `index_nitro_component_transition_pto_hours_on_user_id` (`user_id`),
KEY `index_nitro_component_transition_pto_hours_on_pay_period_id` (`pay_period_id`),
KEY `index_nitro_component_transition_pto_hours_on_created_by_id` (`created_by_id`)
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
@thestephenmarshall
thestephenmarshall / fibonacci.js
Last active April 12, 2017 19:24
ES6 Fibonacci Sequence
// https://es6console.com/j1fcx8bv
const fibonacci = (startNum=0, prevNum, stopAt=88) => {
let newNum;
if(typeof(prevNum) === 'undefined') {
newNum = startNum || 1;
console.log('start fibonacci...');
console.log(startNum);
fibonacci(startNum, newNum, stopAt);
return;
@thestephenmarshall
thestephenmarshall / coffee.js
Last active April 18, 2016 19:02
Rancillio coffee maker script!
class Rancilio {
turnOn() {
console.log('Turning the machine on...');
return new Promise((resolve, reject) => {
setTimeout(() => {
console.log('Machine is on!');
resolve();
}, 1000);
});
}
@thestephenmarshall
thestephenmarshall / waitloop.js
Last active October 29, 2015 15:58
Wait for loop to complete using async/await
async () => {
let done = () => {
return new Promise((resolve, reject) => {
async () => {
let completed = 0;
const list = [0,1,2];
for(let x in list) {
let tbd = () => {
return new Promise((resolve, reject) => {
setTimeout(() => {
@thestephenmarshall
thestephenmarshall / dockeraliases.md
Last active August 29, 2015 14:27
Docker Aliases
alias dockme='bash -c "export PATH='"'"'/Applications/Kitematic (Beta).app/Contents/Resources/resources:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin'"'"' && clear && DOCKER_HOST=tcp://192.168.99.100:2376 DOCKER_CERT_PATH=$HOME/.docker/machine/machines/dev DOCKER_TLS_VERIFY=1 /bin/zsh"'
alias dcup='docker-compose up'
alias dbld='docker-compose build'
alias dps='docker ps'
alias dkill='docker rm $(docker stop $(docker ps -aq))'
<!--<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>-->
<script src="https://www.dropbox.com/s/mx9ty7s4z5txhbm/isotope.pkgd.min.js?dl=1"></script>
<script>
setTimeout(function(){
$('#main .date-outer .date-posts').each(function(i, dp){
var $container = $(this).isotope({
itemSelector: '.post-outer',
layoutMode: 'masonry',
masonry: {
columnWidth: '.post-outer'