Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://unpkg.com/topojson-client@3"></script>
<script src="https://d3js.org/d3.v5.min.js"></script>
<title>Document</title>
</head>
@fecony
fecony / README.md
Created January 7, 2022 23:29
Generate json data for Prisma countries, state and city seeding 🗄

// Countries, states, cities taken from https://github.com/dr5hn/countries-states-cities-database

// I had the idea of seeding the database with countries, states, and cities. // I tried to generate seed files with data from json files. I created data.json, copied in json of countries, and then used code.js file to parse data as I need.

// But after seeding, I realized that it didn't make sense. // And it's better to generate cities/countries/states as you go, as users add data for that particular location. // Cities SQL file takes 12,6 MB on disk // Just use SQL files...

@kflorence
kflorence / markdown-toc-tree.sh
Last active April 26, 2024 20:30
Creates a markdown table of contents from a file tree (omitting the directory itself, "readme.md" files and "images" folders and their contents)
#!/usr/bin/env bash
# This script generates markdown from the output of the `tree` command.
# See: https://linux.die.net/man/1/tree
# See: https://gist.github.com/kflorence/7f18ad97c65337ef77d37159260a331d
set -e
# Tree is configured with:
# - `-f`: use full paths in output (relative to directory given, in this case '.').
# - `--noreport`: exclude the directories and files report as the last line of output.
@skorytnicki
skorytnicki / sendmail.js
Last active April 26, 2024 20:30
EmailLabs Node.js integration
const request = require('request');
const smtp = '1.yoursmtp.smtp';
const appkey = 'yourappkey';
const secret = 'yoursecret';
const options = {
method: 'POST',
url: 'https://api.emaillabs.net.pl/api/new_sendmail',
form: {
d3 = function() {
var d3 = {
version: "3.2.7"
};
if (!Date.now) Date.now = function() {
return +new Date();
};
var d3_document = document, d3_documentElement = d3_document.documentElement, d3_window = window;
try {
d3_document.createElement("div").style.setProperty("opacity", 0, "");
@divamgupta
divamgupta / distilbert_tokenise.js
Created March 25, 2022 05:55
Simple one file tokeniser for DistilBERT in javascript
vocab_string = `[PAD]
[unused0]
[unused1]
[unused2]
[unused3]
[unused4]
[unused5]
[unused6]
[unused7]
@ChickenProp
ChickenProp / README.md
Last active April 26, 2024 20:30
Political Polarization in the US House of Representatives

If you intend to fork this, please note that it contains my Google Analytics tracking code.

Summary

This is a visualization of political polarization in the US House of Representatives, as calculated by DW-NOMINATE. DW-NOMINATE allows one to calculate the political leaning of a member simply by comparing their voting record to others', ignoring their party affiliation and even the content of the bills they vote on.

Design

My initial idea was to draw the career progression of every House member as a distinct path, color coded according to their party affiliation in any given congress. The user would also be able to select members to view detailed statistics about them. But when I implemented that, I discovered it was far too noisy. Trends were difficult to make out, few individual members were discernible, and the elements used to represent them were so small that they were almost impossible to select. Feedback #1 confirmed that this was

// Based on Kickstarter-Prelude version
// https://github.com/kickstarter/Kickstarter-Prelude/blob/master/Prelude-UIKit/UIImage.swift
extension UIImage {
/**
- parameter color: A color.
- returns: A 1x1 UIImage of a solid color.
*/
static func pixel(ofColor color: UIColor) -> UIImage {
let lightModeImage = UIImage.generatePixel(ofColor: color, userInterfaceStyle: .light)
@nengelmann
nengelmann / clx.go
Created April 26, 2024 20:29 — forked from Sh4yy/clx.go
Generate CLI commands for common tasks.
package main
import (
"context"
"errors"
"fmt"
"io"
"log"
"os"
"runtime"
@Eskimonian
Eskimonian / 4dx-changes.user.js
Last active April 26, 2024 20:29
CivicPlus - UserScripts
// ==UserScript==
// @name 4dx Changes
// @author GSHR
// @match *://www.4dxos.com/*
// @require http://code.jquery.com/jquery-3.3.1.min.js
// @downloadURL https://gist.github.com/TheEskimonian/3e94bb640294816719628c89b519a1ac/raw/4dx-changes.user.js
// @version 2.0
// @description 4dx Updates
// @run-at document-start
// ==/UserScript==