Skip to content

Instantly share code, notes, and snippets.

View vedovelli's full-sized avatar
💭
🚀

Fábio Vedovelli vedovelli

💭
🚀
View GitHub Profile
@vedovelli
vedovelli / db.server.ts
Created September 23, 2022 18:37
Remix Prisma DB server
// @ts-nocheck
import { PrismaClient } from '@prisma/client';
let db: PrismaClient;
declare global {
let __db: PrismaClient | undefined;
}
// this is needed because in development we don't want to restart

Converting Tailwind UI Alpine transitions to Vue transitions

After you copy a component from the Tailwind UI library and begin to adapt it from Vue JS to Alpine JS .. you may wonder what to do about the transitions. As I'm exploring this myself, I am documenting it for others in the same boat.

Things to be aware of:

  • Alpine calls the beginning and ending states "start" & "end"
  • Vue calls the beginning and ending states "from" and "to"
  • Alpine has inline "directives" ie x-transition:enter="classes"
  • Vue has a wrapper component that applies classes to the child
  • Alpine applies the classes you pass it for each state, :enter-start="class"

Strings

String.prototype.*

None of the string methods modify this – they always return fresh strings.

  • charAt(pos: number): string ES1

    Returns the character at index pos, as a string (JavaScript does not have a datatype for characters). str[i] is equivalent to str.charAt(i) and more concise (caveat: may not work on old engines).

import React from "react";
import { render } from "react-dom";
const ParentComponent = React.createClass({
getDefaultProps: function() {
console.log("ParentComponent - getDefaultProps");
},
getInitialState: function() {
console.log("ParentComponent - getInitialState");
return { text: "" };
@juliobitencourt
juliobitencourt / gulpfile.js
Last active August 29, 2015 14:22
Web Apps with Sass and Duo.js
var gulp = require('gulp');
var browserSync = require('browser-sync').create();
var sass = require('gulp-sass');
var exec = require('child_process').exec;
gulp.task('browser-sync', function() {
browserSync.init({
proxy: "app.dev",
notify: false

Setup Mac OS X (Sierra)

1. Run Software Update

Make sure everything is up to date.

2. Install Xcode and its "Command Line Tools"

  1. Go to App Store and install Xcode.

Folder Structure

Please note

While this gist has been shared and followed for years, I regret not giving more background. It was originally a gist for the engineering org I was in, not a "general suggestion" for any React app.

Typically I avoid folders altogether. Heck, I even avoid new files. If I can build an app with one 2000 line file I will. New files and folders are a pain.

@dergachev
dergachev / GIF-Screencast-OSX.md
Last active May 2, 2024 05:55
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@zenorocha
zenorocha / README.md
Last active April 6, 2024 16:59
A template for Github READMEs (Markdown) + Sublime Snippet

Project Name

TODO: Write a project description

Installation

TODO: Describe the installation process

Usage