Skip to content

Instantly share code, notes, and snippets.

View agustif's full-sized avatar

Agusti F. agustif

View GitHub Profile
@premek
premek / mv.sh
Last active March 5, 2024 17:43
Rename files in linux / bash using mv command without typing the full name two times
# Put this function to your .bashrc file.
# Usage: mv oldfilename
# If you call mv without the second parameter it will prompt you to edit the filename on command line.
# Original mv is called when it's called with more than one argument.
# It's useful when you want to change just a few letters in a long name.
#
# Also see:
# - imv from renameutils
# - Ctrl-W Ctrl-Y Ctrl-Y (cut last word, paste, paste)
@agmm
agmm / nextjs-file-upload-api.js
Created January 31, 2020 23:03
Simple Nextjs File Upload — Backend API
// Backend
import formidable from 'formidable';
export const config = {
api: {
bodyParser: false,
},
};
export default async (req, res) => {
@gvoze32
gvoze32 / ffmpeg GIF to MP4.MD
Last active January 2, 2026 15:43
Convert animated GIF to MP4 using ffmpeg in terminal.

To convert animation GIF to MP4 by ffmpeg, use the following command

ffmpeg -i animated.gif -movflags faststart -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" video.mp4

Description

movflags – This option optimizes the structure of the MP4 file so the browser can load it as quickly as possible.

pix_fmt – MP4 videos store pixels in different formats. We include this option to specify a specific format which has maximum compatibility across all browsers.

@TrillCyborg
TrillCyborg / apollo.ts
Created November 14, 2019 21:08
Next.js / Accounts.js
import fetch from 'isomorphic-unfetch'
import { ApolloClient } from 'apollo-client'
import { ApolloLink } from 'apollo-link'
import { createHttpLink } from 'apollo-link-http'
import { InMemoryCache, NormalizedCacheObject } from 'apollo-cache-inmemory'
import { AccountsGraphQLClient } from '@accounts/graphql-client'
import { AccountsClientPassword } from '@accounts/client-password'
import { AccountsClient } from '@accounts/client'
import { accountsLink } from '@accounts/apollo-link'
import { tokenStorage } from './token-storage'
@willopez
willopez / docker_aliases.txt
Last active November 17, 2019 20:47
Useful Docker and Docker Compose aliases
alias dc='docker-compose'
# Bring all services down
alias dcd='docker-compose down'
# Attach to all logs of all services
alias dcl='docker-compose logs -f'
# Run a comand inside a running container
alias dcr='docker-compose run --rm'
@annjawn
annjawn / customDatepicker.js
Last active December 30, 2021 02:28
Keyboard and Performance friendly Ant Design Datepicker
import React, { Component } from "react";
import { Popover, Input, Calendar, Icon, Select, Button, Col, Row } from "antd";
import debounce from "lodash/debounce";
import moment from "moment";
import "antd/dist/antd.css";
class DatePicker extends Component {
static getDerivedStateFromProps(nextProps) {
// Should be a controlled component.
if ("value" in nextProps) {
@martpie
martpie / ActiveLink.tsx
Created July 26, 2019 11:53
ActiveLink component for Next.js 9
type Post {
id: ID! @unique
createdAt: DateTime!
updatedAt: DateTime!
title: String!
published: Boolean! @default(value: "false")
author: User
comments: [Comment!]!
}
@agustif
agustif / README.md
Created October 29, 2018 14:42 — forked from a-barbieri/README.md
NextJS sitemap generator with dynamic URL

NextJS sitemap generator

Install

The current setup has been tested on Next Js 7.0.0.

You need to install Axios.

$ npm install axios