Skip to content

Instantly share code, notes, and snippets.

View Thivieira's full-sized avatar

Thiago Vieira Thivieira

View GitHub Profile
{
"editor.multiCursorModifier": "ctrlCmd",
"editor.snippetSuggestions": "top",
"editor.formatOnPaste": true,
"editor.fontFamily" : "Fira Code",
"editor.fontLigatures": true,
"emmet.triggerExpansionOnTab": true,
"php.suggest.basic": false,
"editor.autoIndent": true,
"emmet.includeLanguages" : {
@gabrielfroes
gabrielfroes / slugify.js
Last active February 6, 2024 23:36 — forked from mathewbyrne/slugify.js
Javascript Slugify
/*
Create SLUG from a string
This function rewrite the string prototype and also
replace latin and other special characters.
Forked by Gabriel Froes - https://gist.github.com/gabrielfroes
Original Author: Mathew Byrne - https://gist.github.com/mathewbyrne/1280286
*/
if (!String.prototype.slugify) {
String.prototype.slugify = function () {
@cereallarceny
cereallarceny / index.js
Created October 12, 2017 20:37
Server-side rendering with create-react-app (Fiber), React Router v4, Helmet, Redux, and Thunk
// Ignore those pesky styles
require('ignore-styles');
// Set up babel to do its thing... env for the latest toys, react-app for CRA
require('babel-register')({
ignore: /\/(build|node_modules)\//,
presets: ['env', 'react-app']
});
// Now that the nonsense is over... load up the server entry point
<template>
<div id="app">
<p>
Pending: {{ $store.state.getInfoPending }}
</p>
<p>
{{ $store.state.getInfoData }}
</p>
</div>
</template>
@nikkanetiya
nikkanetiya / axios-nprogress.js
Created September 6, 2017 12:40
NProgress bar with axios
import 'nprogress/nprogress.css'
import NProgress from 'nprogress'
import axios from 'axios'
const calculatePercentage = (loaded, total) => (Math.floor(loaded * 1.0) / total)
const setupUpdateProgress = () => {
axios.defaults.onDownloadProgress = e => {
const percentage = calculatePercentage(e.loaded, e.total)
@firatkucuk
firatkucuk / delete-slack-messages.js
Last active May 1, 2024 04:17
Deletes slack public/private channel messages, private chat messages and channel thread replies.
#!/usr/bin/env node
// Channel ID is on the the browser URL.: https://mycompany.slack.com/messages/MYCHANNELID/
// Pass it as a parameter: node ./delete-slack-messages.js CHANNEL_ID
// CONFIGURATION #######################################################################################################
const token = 'SLACK TOKEN';
// Legacy tokens are no more supported.
// Please create an app or use an existing Slack App
@Atinux
Atinux / index.vue
Created July 4, 2017 10:25
Dynamic image nuxt
<template>
<div>
<h1>Welcome!</h1>
<nuxt-link to="/about">About page</nuxt-link>
<img :src="flagUrl"/>
<button @click="nextFlag">Next flag</button>
</div>
</template>
<script>
@haskaalo
haskaalo / tarcheatsheet.md
Last active April 8, 2024 14:19
Tar usage / Tar Cheat Sheet

Tar Usage / Cheat Sheet

Compress a file or directory

e.g: tar -czvf name-of-archive.tar.gz /path/to/directory-or-file

  • -c: Create an archive.
  • -z: Compress the archive with gzip.
  • -v: makes tar talk a lot. Verbose output shows you all the files being archived and much.
  • -f: Allows you to specify the filename of the archive.
@krisanalfa
krisanalfa / Wrapper.php
Created June 6, 2017 05:00
Tiny Guzzle Wrapper
<?php
namespace Alpha;
use GuzzleHttp\Client;
class Wrapper
{
protected static $client;
@iamc
iamc / mic-loopback.sh
Created May 18, 2017 08:46
script to enable/disable pulseaudio loopback module in order to get eg. mic feedback
#!/bin/bash
#
# Loads / unloads pulseaudio loopback module in order to eg. be redirect
# mic input to headphones.
#
# Usage: mic-loopback [on|off]
#
if [ $# -ne 1 ]; then
echo "Usage: $0 [on|off]"