Skip to content

Instantly share code, notes, and snippets.

View Profpatsch's full-sized avatar
🌮

Profpatsch

🌮
View GitHub Profile
@zyxar
zyxar / exercise.tour.go
Last active October 31, 2024 22:30
tour.golang exercise solutions
/* Exercise: Loops and Functions #43 */
package main
import (
"fmt"
"math"
)
func Sqrt(x float64) float64 {
z := float64(2.)
@pcdavid
pcdavid / setup-external-screen
Last active September 27, 2018 13:47
Enabling 2560x1440 under Linux (tested with Ubuntu 13.10 on an Asus Zen Prime UX31A with Intel HD 4000 and a Iiyama XB2779QS)

Try 55 Hz if possible:

% xrandr --newmode "2560x1440_55.00" 220.812 2560 2608 2640 2720 1440 1443 1448 1478 -hsync -vsync
% xrandr --addmode HDMI1 "2560x1440_55.00"

or 30 Hz otherwise:

% xrandr --newmode "2560x1440_30.00" 146.25 2560 2680 2944 3328 1440 1443 1448 1468 -hsync +vsync
% xrandr --addmode HDMI1 "2560x1440_30.00"
@qntm
qntm / multiline.js
Last active October 16, 2023 12:39
// TODO: longer method name
Function.prototype.extractBlockCommentAsMultilineString = function() {
return this.toString().match(/^function \(\)\{\s*\/\*((?:[^*]|\*+[^*\/])*)\*+\/\s*\}$/)[1];
};
var s = function(){/*
STRING
GOES
HERE
*/}.extractBlockCommentAsMultilineString();