Skip to content

Instantly share code, notes, and snippets.

View vicapow's full-sized avatar

Victor vicapow

View GitHub Profile
@vicapow
vicapow / main.tex
Created November 10, 2024 22:41
Example of using tcolorbox in Latex / Ejemplo de uso de tcolorbox en LaTeX
\documentclass{article}
\usepackage{tcolorbox}
\newtcolorbox{shadedsection}[1][]{ % Custom box with options / Caja personalizada con opciones
colback=blue!20, % Background color of the box / Color de fondo de la caja
colframe=blue!50, % Border color of the box / Color del borde de la caja
boxrule=0pt, % Border thickness (0pt = no border) / Grosor del borde (0pt = sin borde)
width=\textwidth, % Box width, same as the text width / Ancho de la caja, igual al ancho del texto
sharp corners, % No rounded corners / Sin esquinas redondeadas
left=0pt, right=0pt, top=2pt, bottom=2pt, % Padding / Relleno
@vicapow
vicapow / main.tex
Last active November 3, 2024 20:19
Attempting to replicate the gradetable macro of the exam package in Latex
% In response to the stackexchange question: https://tex.stackexchange.com/questions/680066/customising-gradetable-to-group-multiple-choice-into-1-column-with-the-exam-cl
% You can compile and view the pdf version of this Latex document at: https://crixet.com/?gist=d433f7deda0eb630dad9b98bb3b281b9
\documentclass[addpoints]{exam}
\usepackage{tabularx}
\usepackage{xcolor}
\usepackage{multicol}
\begin{document}
@vicapow
vicapow / main.tex
Last active November 3, 2024 06:27
% Original question on Reddit: https://www.reddit.com/r/LaTeX/comments/1gi75el/these_commands_arent_working_any_help/
% To view the source code or fork it, see: https://gist.github.com/vicapow/fd736f10b9382e924875f4e093a63d33
% Note, you may need to compile twice to ensure the refernces get updated completely.
\documentclass{article}
\usepackage{amsmath} % Required for split and align environments
(async function() {
async function fetchData(date) {
var date_split = date.split('-'),
year = date_split[0],
month = date_split[1],
day = date_split[2];
if (parseInt(day) < 10){
day = parseInt(day);
}
month = parseInt(month) - 1;
@vicapow
vicapow / main.cpp
Created June 29, 2020 17:35
C++ rvalue reference and move semantics
#include <iostream>
#include <vector>
using namespace std;
struct A {
int * ptr;
A() {
cout << "Constructor" << endl;
ptr = new int;
@vicapow
vicapow / remove-lodash-es.js
Created March 6, 2020 21:46
convert lodash-es back to lodash
export default function transformer(file, api) {
const j = api.jscodeshift;
const root = j(file.source);
let body;
root.find(j.Program).map(program => {
body = program.value.body;
});
const lodashImports = root
@vicapow
vicapow / styled-components_v4.x.x.js
Created February 12, 2019 04:03
styled-components_v4.x.x.js
// @flow
declare module 'styled-components' {
// { type: '__styled' } is really only used ot avoid type collisions
// betwteen the interpolation unions types of (props: P) => string | number)
// and StyledComponent<any>.
declare export type StyledComponent<Props> = { type: '__styled' } & React$ComponentType<Props>;
declare export type Interpolation<P> =
| StyledComponent<any> // Order seems to matter unexpectedly.
@vicapow
vicapow / d3_v3.x.x.x.js
Created February 8, 2019 22:16
A d3 v3 Flow libdef
// @flow
declare module 'd3' {
declare module.exports: $Exports<'d3-es6-module'>;
}
declare module 'd3-es6-module' {
/**
* The current version of D3.js.
*/
// @flow
/* global process */
/* eslint-disable no-process-env */
const { execSync } = require('child_process');
const packageJson = require('../../package');
const execpath = process.env && process.env.npm_execpath;
if (execpath) {
if (!execpath.includes('yarn')) {
@vicapow
vicapow / feature-collection.json
Created October 24, 2017 22:37
Example GeoJSON that demonstrates the flicker/jagged issue in DeckGL
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.