Skip to content

Instantly share code, notes, and snippets.

// useViewport.js
import { useState, useEffect } from 'react';
const breakpoints = ['768px', '1024px', '1280px'];
const aliases = ['tablet', 'desktop', 'desktopL'];
const viewports = {};
breakpoints.forEach((bp, i) => {
viewports[`(min-width: ${bp})`] = aliases[i];
});
@cesosag
cesosag / helpers.sass
Last active March 18, 2019 20:50
Collection of helper classes
// Responsive video
.video-container
height: 0
overflow: hidden
padding-bottom: 56.25%
padding-top: 35px
position: relative
iframe
height: 100%
@cesosag
cesosag / appendChildren.js
Last active August 3, 2018 15:33
Function to append multiple items to a DOM node
Node.prototype.appendChildren = function(children) {
const fragment = document.createDocumentFragment();
Array.prototype.forEach.call(children, (child) => {
fragment.appendChild(child.cloneNode(true));
});
return this.appendChild(fragment);
}
alias ls='ls -GFh'
alias ll='ls -alh'
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced
# Color Code me Bro
RED='\[\033[31m\]'
GREEN='\[\033[32m\]'
YELLOW='\[\033[33m\]'
@cesosag
cesosag / .hyper.js
Created December 20, 2017 15:20
Hyper configuration and plugins
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// Choose either "stable" for receiving highly polished,
// or "canary" for less polished but more frequent updates
updateChannel: 'stable',
@cesosag
cesosag / keybindings.json
Created November 1, 2017 20:28 — forked from funnierinspanish/keybindings.json
VS Code keyboard shortcuts
// Place your key bindings in this file to overwrite the defaults
[
{ "key": "ctrl+shift+up", "command": "editor.action.moveLinesUpAction",
"when": "editorFocus" },
{ "key": "ctrl+shift+down", "command": "editor.action.moveLinesDownAction",
"when": "editorFocus" },
{ "key": "alt+up", "command": "editor.action.insertCursorAbove",
"when": "editorTextFocus" },
@cesosag
cesosag / bash_prompt.sh
Created October 23, 2017 19:41 — forked from romanlevin/bash_prompt.sh
Set color bash prompt according to active pyenv, git branch and return status of last command.
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the active virtualenv
# * the branch/status of the current git repository
# * the return value of the previous command
# * the fact you just came from Windows and are used to having newlines in
# your prompts.
#!/usr/bin/env bash
pathName="Stremio3.5.7.linux"
dir="/opt/stremio"
echo "Installing dependencies..."
sudo apt-get install libappindicator1 python-gpgme libindicator7
if [ ! -f ./$pathName.tar.gz ]; then
echo "File not found! Downloading..."
<?php $output = shell_exec('git fetch --all && git reset --hard origin/master'); ?>
<style>
body{
background-color: #1A1A1A;
color:#fff;
}
pre{
padding:20px;
}
@cesosag
cesosag / mixins.sass
Last active August 3, 2018 15:34
Useful SASS mixins & functions
//Fullscreen mode
=fullscreen()
&:-webkit-full-screen
@content
&:-moz-full-screen
@content
&:-ms-fullscreen
@content
&:fullscreen
@content