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 / 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
@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 / 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 / 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 / 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 / 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 / github-issues-to-md.js
Last active June 27, 2019 09:52
Get all visible issues on GitHub and convert to string
// This script transforms all visible issues on the current screen to a string.
// Handy, when you need to reference issues on platforms without GitHub integration.
// Just filter your issues, copy the script to your console, and voila.
(function () {
function issueRowToString($row) {
const id = $row.id.replace('issue_', '#');
const $title = $row.querySelector('[data-hovercard-type="issue"]');
@vincevargadev
vincevargadev / main.dart
Created December 4, 2019 22:14
I tried out the new DartPad!
import 'dart:math' as math;
import 'package:flutter/material.dart';
final dscTeam = [
{
'name': 'Viviana Sutedjo',
'nickName': 'Vivi',
'color': getRandomColor(),
},
@vincevargadev
vincevargadev / in-console.js
Last active January 28, 2020 21:14
Get first and last names from meetup event
/**
* HOW TO USE IT
* Go the your event, then select attendee list.
* Make sure you are on the "Going" tab.
*/
const $attendees = Array.from(document.querySelectorAll('h4.text--ellipsisOneLine'));
// Sorted names.
// Start with long names, then leave the names with no spaces to the end.