Skip to content

Instantly share code, notes, and snippets.

View rcobiella's full-sized avatar

Rafa Cobiella rcobiella

View GitHub Profile
@jordienr
jordienr / Gradient.js
Created September 12, 2021 00:23
Stripe Mesh Gradient WebGL
/*
* Stripe WebGl Gradient Animation
* All Credits to Stripe.com
* ScrollObserver functionality to disable animation when not scrolled into view has been disabled and
* commented out for now.
* https://kevinhufnagl.com
*/
<?php
/**
* Lorem Ipsum Generator
*
* PHP version 5.3+
*
* Licensed under The MIT License.
* Redistribution of these files must retain the above copyright notice.
*
@robertcoopercode
robertcoopercode / loremipsum.php
Last active June 20, 2022 10:36
Raycast script for lorem ipsum text. Related utils file found at https://gist.github.com/robertcoopercode/e9ed269fdbffe63a440e98cf8575779b
#!/usr/bin/env php
# Dependency: This script requires PHP
# Install PHP: https://www.php.net/manual/en/install.php
#
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Lorem Ipsum
# @raycast.mode compact
# @raycast.packageName Lorem Ipsum
@bcnzer
bcnzer / launch.json
Created December 25, 2019 00:40
VS Code launch.json to enable debugging of Nuxt.js apps. Note a further change is required in your nuxt.config.js
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "client: chrome",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}",
"sourceMapPathOverrides": {
@firestar300
firestar300 / nextAll.js
Created January 15, 2019 08:50
nextAll method with Vanilla JS
export const nextAll = element => {
const nextElements = []
let nextElement = element
while(nextElement.nextElementSibling) {
nextElements.push(nextElement.nextElementSibling)
nextElement = nextElement.nextElementSibling
}
return nextElements
@liborvanek
liborvanek / transition.js
Last active April 26, 2023 11:43
Page transition mixin for Nuxt.js with GreenSock GSAP
import { TimelineMax, TweenMax, Power2, Back } from 'gsap'
let curtainsOpenTimeline = () => {
return new TimelineMax()
.set('.curtains', { transformOrigin: '0%' })
.fromTo('.curtains', 0.6, { scaleX: 0 }, { scaleX: 1, ease: Power2.easeInOut })
.fromTo('.curtains-logo', 0.3, { x: '-100%', autoAlpha: 0 }, { x: '-50%', autoAlpha: 1, ease: Power2.easeInOut }, '-=0.45')
}
let curtainsCloseTimeline = () => {
@bovas85
bovas85 / store.js
Created April 10, 2018 11:29
Cache API calls in Vuex on nuxtServerInit
import Vuex from "vuex";
import axios from "axios";
import Config from "~/assets/config.js";
const api = axios.create();
let arr = [];
let count = 0;
/**
* This is the secret sauce.
* If the data being requested is cached, subsequent API calls will not be made
* During a nuxt generate, nuxtServerInit will be called for every page
@DreaMinder
DreaMinder / A Nuxt.js VPS production deployment.md
Last active July 13, 2024 13:46
Deployment manual for a real-world project built with nuxt.js + koa + nginx + pm2

Example of deployment process which I use in my Nuxt.js projects. I usually have 3 components running per project: admin-panel SPA, nuxt.js renderer and JSON API.

This manual is relevant for VPS such as DigitalOcean.com or Vultr.com. It's easier to use things like Now for deployment but for most cases VPS gives more flexebillity needed for projects bigger than a landing page.

UPD: This manual now compatible with nuxt@2.3. For older versions deployment, see revision history.


Let's assume that you have entered fresh installation of Ubuntu instance via SSH. Let's rock:

@dohomi
dohomi / component.vue
Last active February 23, 2021 10:16
combine Nuxt asyncData with vue-apollo and watchQuery for client search
<script>
import allTravelsGql from '../../GQL/travel/allTravels.gql'
import {pagination, getSkipFirst} from '../../../generated-cms/util/pagination'
import {getTravelQuery, setCategoryOnQuery} from '../../util/getTravelQuery'
const buildQuery = variables => {
return {
query: allTravelsGql,
variables,
manual: true,
@niw
niw / fetch_nike_puls_all_activities.bash
Last active July 16, 2024 23:37
A simple NikePlus API description to fetch past run metrics
#!/usr/bin/env bash
# fetch_nike_puls_all_activities.bash
# A simple bash script to fetch all activities and metrics from NikePlus.
# See `nike_plus_api.md` for the API details.
readonly bearer_token="$1"
if [[ -z "$bearer_token" ]]; then
echo "Usage: $0 bearer_token"
exit