Skip to content

Instantly share code, notes, and snippets.

stevecastaneda / Example.tsx
Created Jul 16, 2020
A Tailwind-ready Modal using React Aria from Adobe
View Example.tsx
import React, { useState, useContext, useRef } from "react";
import { useOverlayTriggerState } from "@react-stately/overlays";
import { useButton } from "@react-aria/button";
import { Modal } from "components/overlays/Modal";
export function Example() {
let state = useOverlayTriggerState({});
function onOpen() {;
stevecastaneda / callable.tsx
Last active Jun 29, 2020
This simple callable function throws a deadline-exceed error, even when it successfully returns a response.
View callable.tsx
import React, { useEffect } from "react";
// Run the callable function on mount only once by adding an empty array.
export function Callable() {
useEffect(() => {
async function helloWorld() {
try {
const helloWorldCallableFunction = functions.httpsCallable("helloWorld", { timeout: 10000 });
const response = await helloWorldCallableFunction();
stevecastaneda / CSSTransition.tsx
Last active Jun 15, 2020
CSSTransition component (Typescript). This one allows you use TransitionGroup with Tailwind, animating in a list of items.
View CSSTransition.tsx
import React, { ReactNode } from "react";
import { CSSTransition as ReactTransition } from "react-transition-group";
interface TransitionProps {
in?: boolean;
timeout: number;
enter?: string;
enterFrom?: string;
enterTo?: string;
leave?: string;
stevecastaneda / CSSTransition.tsx
Created Jun 10, 2020
A CSS Transition component to use as a child of TransitionGroup.
View CSSTransition.tsx
import React, { ReactNode } from "react";
import { Transition as ReactTransition } from "react-transition-group";
interface TransitionProps {
in?: boolean;
timeout: number | { appear?: number; enter?: number; exit?: number };
enter?: string;
stevecastaneda / ModalExample.tsx
Last active Jul 26, 2020
[Typescript] Modified Transition React Component to Support Nested Transitions w/ Tailwind
View ModalExample.tsx
// Modal Source:
import React, { ReactNode } from "react";
import { Transition } from "components/transition";
interface Props {
/** The modal open/close state */
open: boolean;
stevecastaneda /
Created May 6, 2011 — forked from ryanb/
The Changelogs for Rails 3.1 Beta 1

Railties 3.1 Beta 1

  • The -j option of the application generator accepts an arbitrary string. If passed "foo", the gem "foo-rails" is added to the Gemfile, and the application JavaScript manifest requires "foo" and "foo_ujs". As of this writing "prototype-rails" and "jquery-rails" exist and provide those files via the asset pipeline. Default is "jquery". [fxn]

  • jQuery is no longer vendored, it is provided from now on by the jquery-rails gem. [fxn]

  • Prototype and Scriptaculous are no longer vendored, they are provided from now on by the prototype-rails gem. [fxn]

  • The scaffold controller will now produce SCSS file if Sass is available [Prem Sichanugrist]

View Reschedule Tasks (new)
// Remove the task from the UI
$("#task_<%= %>").slideUp("slow", function() {
// Reload the tasks
$("#tasks").html("<%= escape_javascript(render(:partial => 'tasks/tasks'))%>");
// Highlight the task that was rescheduled
$("#task_<%= %>").effect("highlight", {}, 1250);
View Reschedule Tasks (old)
// Detach the task from it's current location and save to var task
var task = null;
task = $("#task_<%= %>").detach();
// Was this the last task for one of the sections?
// If so, remove the header and spacer (remove), add no-tasks span if today
if($("#tasks_today > div.task").length == 0) {
if($("#tasks_today").children("div").children("span").length == 0) {
$("#tasks_today > hr").before('<div class="span-7 last"><span>Nothing to do. <%= link_to "Bored?", "#", :id => "bored_link" %></span></div>');