Skip to content

Instantly share code, notes, and snippets.

View A1rPun's full-sized avatar
🌊
Fractalicious

Thom Bakker A1rPun

🌊
Fractalicious
  • The Netherlands
View GitHub Profile
@vidul-nikolaev-petrov
vidul-nikolaev-petrov / ascci_hex_string.js
Created December 19, 2016 16:13
Tiny helpers: ASCII HEX STRING
function string2ascii(string, sep) {
return string.split('')
.map(e => e.charCodeAt(0)).join(sep ? sep : '');
}
function string2hex(string, sep) {
return string.split('')
.map(e => e.charCodeAt(0).toString(16)).join(sep ? sep : '');
}
@basp
basp / CropFieldFlurlExample.cs
Last active December 1, 2016 09:25
Converting GeoJSON to CropFields with Flurl
void Main()
{
var result = "http://localhost:3000/test.json"
.GetAsync()
.ReceiveCropFields()
.Dump();
}
static class HttpResponseMessageExtensions
{
@manuel-factual
manuel-factual / state_monad_motivation.hs
Last active September 14, 2019 11:58
Notes about motivation for using state monad. No tutorial for actually how it works, there's documentation for that.
import Control.Monad.State
import qualified Data.Map.Strict as M
------------------------------------------------------
-- This is a thought process for why you might want to learn about
-- the state monad.
-- Let's say we want to implement a function to calculate the nth
-- fibonacci number. Here's the straightforward implementation.
@t-nissie
t-nissie / fib.jl
Last active May 31, 2021 22:14
Three ways of generating n-th Fibonacci number in Julia language
#!/usr/bin/env julia
# Gist: https://gist.github.com/t-nissie/641df996b9035f85b230
# Three ways of generating n-th Fibonacci number in Julia language
# Put perfutil.jl in the same directory as:
# wget https://raw.githubusercontent.com/JuliaLang/julia/master/test/perf/perfutil.jl
# Turn off garbage collection (GC), when you get occasional bad timings. See perfutil.patch below.
###
using Base.Test
include("perfutil.jl")
@AllThingsSmitty
AllThingsSmitty / rainbow.css
Created January 17, 2016 15:21
Animated background color shift
/* based on dbox.us */
body {
background: linear-gradient(238deg, #fd8800, #fd008f, #9700fd, #003dfd, #05c7e6, #4bd58d);
background-size: 1200% 1200%;
-webkit-animation: rainbow 30s ease infinite;
animation: rainbow 30s ease infinite;
}
@-webkit-keyframes rainbow {
0% { background-position: 0% 50% }
50% { background-position: 100% 50% }
@ythecombinator
ythecombinator / change-commit-date.md
Last active March 16, 2022 18:35
Changin' a commit timestamp.

Changing a commit date info

Reason

My country is under a daylight saving time period and not all my commits are made during the morning/afternoon. Because I commited after 11:00 PM - which, given the local DST, was after 00:00 AM - my 100+ days commit streak got broken - which made me very unhappy.

The process

@sim642
sim642 / DI.m3u
Created July 5, 2015 12:52
Digitally Imported premium streams
#EXTM3U
#EXTINF:-1,Digitally Imported - Ambient
http://pub1.diforfree.org:8000/di_ambient_hi
#EXTINF:-1,Digitally Imported - Big Room House
http://pub1.diforfree.org:8000/di_bigroomhouse_hi
#EXTINF:-1,Digitally Imported - Breaks
http://pub1.diforfree.org:8000/di_breaks_hi
@A1rPun
A1rPun / scrollspy.js
Last active November 16, 2015 23:02 — forked from pascaldevink/scrollspy.js
/*
Copyright (C) 2021 Pascal de Vink (Tweakers.net)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
;var _ = (function () {
function lo() { }
lo.prototype = {
//XMLHttpRequest wrapper
ajax: function() {
var a = arguments,
requestData,
opts = { method: 'GET', data: null, url: '', async: true, done: null, fail: null, always: null };
@A1rPun
A1rPun / Enum
Last active August 29, 2015 14:05
function mune(){
var a=Array.isArray(arguments[0]) ? arguments[0] : arguments;
for(var i=0,l=a.length,l=l>31?31:l;i<l;i++){this[a[i]] = 1 << i}
}