Skip to content

Instantly share code, notes, and snippets.

Alessandro Balzano alfateam123

Block or report user

Report or block alfateam123

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@davidweatherall
davidweatherall / z.scss
Created Jul 8, 2019
Z index sass helper function
View z.scss
// Z-index mapping: Correctly place your variable in the correct position based on what it should appear above and behind.
// Example usage: z-index: z(header);
$z-list: (
highest,
lowest
);
@function z($var) {
View youman.py
#!/usr/bin/env python3
import os
import shutil
import subprocess
import random
from argparse import ArgumentParser
from argparse import REMAINDER
from pathlib import Path
@arei
arei / IntroZephJS.md
Last active May 8, 2019
Introducing ZephJS!
View IntroZephJS.md

Introducing ZephJS

We are pleased to announce the release of ZephJS!

ZephJS is an extremely easy to use, simple to understand, ultra-light framework for defining and using Web Components. ZephJS is perfect for people writing component libraries, teams building applications or sites that just require a few custom components, or projects building whole applications that do not want the gigantic weight of a modern JavaScript browser framework. ZephJS simplifies the process of defining custom Web Components into a highly readable declarative structure that uses standard JavaScript, standard HTML markup, and standard CSS styling. And ZephJS weighs in at less than 20k minified!

Here's an example of using ZephJS to build a customized button:

my-button.js
@munificent
munificent / generate.c
Last active Sep 16, 2019
A random dungeon generator that fits on a business card
View generate.c
#include <time.h> // Robert Nystrom
#include <stdio.h> // @munificentbob
#include <stdlib.h> // for Ginny
#define r return // 2008-2019
#define l(a, b, c, d) for (i y=a;y\
<b; y++) for (int x = c; x < d; x++)
typedef int i;const i H=40;const i W
=80;i m[40][80];i g(i x){r rand()%x;
}void cave(i s){i w=g(10)+5;i h=g(6)
+3;i t=g(W-w-2)+1;i u=g(H-h-2)+1;l(u
@verticalgrain
verticalgrain / chip-flashing-guide-nov-2018.md
Last active Sep 12, 2019
NextThingCo C.H.I.P. Flashing guide as of November, 2018
View chip-flashing-guide-nov-2018.md

Below are the steps required to flash a NextThingCo CHIP or PocketCHIP from the command line, as of November 2018. The web flasher no longer works, and there are numerous errors when flashing from the command line, mostly due to broken dependencies. The following method works for flashing a CHIP as of November 2018:

Note: Flashing must be done on Linux. Tested on Ubuntu and Rasparian. Mac OS seems to not work.

  1. Download and unpack the CHIP-SDK.zip from one of the following:
  1. Download and unpack CHIP-tools.zip from one of the following:
@Rich-Harris
Rich-Harris / footgun.md
Last active Sep 22, 2019
Top-level `await` is a footgun
View footgun.md

Edit — February 2019

This gist had a far larger impact than I imagined it would, and apparently people are still finding it, so a quick update:

  • TC39 is currently moving forward with a slightly different version of TLA, referred to as 'variant B', in which a module with TLA doesn't block sibling execution. This vastly reduces the danger of parallelizable work happening in serial and thereby delaying startup, which was the concern that motivated me to write this gist
  • In the wild, we're seeing (async main(){...}()) as a substitute for TLA. This completely eliminates the blocking problem (yay!) but it's less powerful, and harder to statically analyse (boo). In other words the lack of TLA is causing real problems
  • Therefore, a version of TLA that solves the original issue is a valuable addition to the language, and I'm in full support of the current proposal, which you can read here.

I'll leave the rest of this document unedited, for archaeological

anonymous
anonymous / playground.rs
Created Jun 20, 2016
Shared via Rust Playground
View playground.rs
fn fizzbuzz(i: u32) -> String {
match i {
//i if (i % 3 ==0 && i%5 == 0) => "FizzBuzz".to_string(),
i if (i % 15 == 0) => "FizzBuzz".to_string(), //do some math and optimize mod+comparison+bool :D
i if (i % 3 ==0 ) => "Fizz".to_string(),
i if (i % 5 == 0) => "Buzz".to_string(),
_ => i.to_string()
}
}
@rygorous
rygorous / gist:e0f055bfb74e3d5f0af20690759de5a7
Created May 8, 2016
A bit of background on compilers exploiting signed overflow
View gist:e0f055bfb74e3d5f0af20690759de5a7
Why do compilers even bother with exploiting undefinedness signed overflow? And what are those
mysterious cases where it helps?
A lot of people (myself included) are against transforms that aggressively exploit undefined behavior, but
I think it's useful to know what compiler writers are accomplishing by this.
TL;DR: C doesn't work very well if int!=register width, but (for backwards compat) int is 32-bit on all
major 64-bit targets, and this causes quite hairy problems for code generation and optimization in some
fairly common cases. The signed overflow UB exploitation is an attempt to work around this.
@RoxasShadow
RoxasShadow / twimg-gm.js
Last active Aug 29, 2016
[https://jii.moe/4kxSLhecl.png] Add an "Open images" link inside the gear to the left of the "Following" button in the tweet modal to open the uncompressed version of each image.
View twimg-gm.js
// ==UserScript==
// @name Twimg gallery opener
// @namespace https://gist.github.com/RoxasShadow/4111c4ad781613069928
// @description Add an "Open images" link inside the gear to the left of the "Following" button in the tweet modal to open the uncompressed version of each image.
// @include https://twitter.com/*
// @author Roxas Shadow
// @version 3
// @grant none
// ==/UserScript==
View dub_techno_in_sonic_pi.rb
use_debug false
use_bpm 130
# Our mixer!
master = (ramp *range(0, 1, 0.01))
kick_volume = 1
bass_volume = 1
revbass_volume = 1
snare_volume = 0.5
hats_volume = 0.5
You can’t perform that action at this time.