Skip to content

Instantly share code, notes, and snippets.

View vincevargadev's full-sized avatar
:shipit:
Ship it!

Vince Varga vincevargadev

:shipit:
Ship it!
View GitHub Profile
@vincevargadev
vincevargadev / dart-interpreter.js
Last active June 20, 2019 10:40
Color palette for mcg.mbitson.com: Dart code Flutter MaterialColor
/* Paste this code snippet into the console to convert to Dart code */
// Based on this, I could also submit a pull request one day...
const name = 'span.name.color-text';
const hex = 'span.palette-color-hex.color-text';
const paletteEntry = '.palette-color';
const mapContent = Array.from(document.querySelectorAll(paletteEntry))
.slice(0, 10)
@vincevargadev
vincevargadev / x.js
Created May 5, 2018 19:42
Remove most visited sites from new tab screen on Google Chrome
// I'm going to create an extension to get rid of the most visited list upon opening a new tab or window in Google Chrome
// TODO: add it to extension, run it on all pages and make sure it won't break totally if the ID changes
if (window.location.pathname === '/_/chrome/newtab') { document.getElementById('most-visited').remove(); }
@vincevargadev
vincevargadev / nextNWeekAfterDate.js
Last active January 14, 2018 11:34
Print next "n" week after a given date in JavaScript
// Three-letter abbreviations of months
const monthAbbrev = 'Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'.split(' ');
// One day in milliseconds. Used for creating new dates "x" days after a given date
const dayMs = 24 * 60 * 60 * 1000;
// I could have just used toLocaleDateString, but this is more flexible and easier to adjust to your needs
const formatDateSimple = d => `${d.getFullYear()} ${monthAbbrev[d.getMonth()]} ${d.getDate()}`;
function getWeekStr(startDate, weekCount, formatDate) {
const weekRange = new Array(weekCount);
for (let i = 0; i < weekCount; i += 1) {
@vincevargadev
vincevargadev / README.md
Last active April 20, 2016 19:46
Markdown. Codeblocks within nested lists.

GitHub Flavored Markdown. For Real

This is some serious meta-neta-nested markdown. I remember the first time I tried to get code blocks to work within a nested ordered list. It was a PITA.

Source:

@vincevargadev
vincevargadev / adjacencyList.c
Last active November 23, 2015 14:29
Read adjacency matrix and linearise network representation.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
/* FYI: C is new for me and don't consider anything you see here as good practice.
* Your feedback is welcome.
*/
#include "asciialerts.h"
@vincevargadev
vincevargadev / readWeightedAdjacencyList.c
Created November 22, 2015 20:50
This short C program reads a weighted adjacency list into a weird format I can't describe in two words.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
/**
* This short C program reads a weighted adjacency list.
*
* Compile
@vincevargadev
vincevargadev / randomGeneratorOnDevice.cu
Last active November 23, 2015 11:49
The curand random generator works well, even if we don't copy data back and forth between the host and the device.
#include <stdio.h>
#include <cuda.h>
#include <curand.h>
#include <sys/time.h>
/**
* This gist tests if the random number generator works as I expect it to,
* even if I don't have an array on host and don't copy random numbers back and forth..
* PROBLEM: In one of my codes I have to use a large (but known) number of
* random numbers on the device in my threads. From the results of my program I suspect