if (condition) {
//stuff
} else {
//stuff
}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.weather | |
#code | |
#condition | |
#sunrise | |
#sunset |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://gist.github.com/TheDistantSea/8021359 | |
function versionCompare(v1, v2, options) { | |
var lexicographical = options && options.lexicographical, | |
zeroExtend = options && options.zeroExtend, | |
v1parts = v1.split('.'), | |
v2parts = v2.split('.'); | |
function isValidPart(x) { | |
return (lexicographical ? /^\d+[A-Za-z]*$/ : /^\d+$/).test(x); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
email=$(git config --global user.email) | |
json=$(curl -s "https://api.github.com/search/users?q=${email}+in:email") | |
echo $json | grep -Po '(?<="login": ")[^"]*' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
dependencies=( | |
"inkscape" | |
"pstoedit" | |
) | |
# check if dependencies are indeed installed | |
for program in "${dependencies[@]}" | |
do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Append the following snippet to your bash.rc | |
#Whenever "git add foo" is ran "git diff" will first run | |
#and require user confirmation before changes are added. | |
git() { | |
if [[ $1 == "add" ]]; then | |
command git diff | |
read -p "Are you sure? " -n 1 -r | |
echo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Quick and dirty script that I'll only use once... | |
// Grabs all the frames in a gif and write them to individual files | |
// | |
// Example | |
// node extractFrames.js --gif path/to/gif | |
const gifFrames = require('gif-frames'); | |
const argv = require('yargs').argv | |
const fs = require('fs'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// More information: https://danielupshaw.com/openscad-rounded-corners/ | |
// Set to 0.01 for higher definition curves (renders slower) | |
$fs = 0.15; | |
module roundedcube(size = [1, 1, 1], center = false, radius = 0.5, apply_to = "all") { | |
// If single value, convert to [x, y, z] vector | |
size = (size[0] == undef) ? [size, size, size] : size; | |
translate_min = radius; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// More information: https://danielupshaw.com/openscad-rounded-corners/ | |
// Set to 0.01 for higher definition curves (renders slower) | |
$fs = 0.15; | |
module roundedcube(size = [1, 1, 1], center = false, radius = 0.5, apply_to = "all") { | |
// If single value, convert to [x, y, z] vector | |
size = (size[0] == undef) ? [size, size, size] : size; | |
translate_min = radius; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 1a74985b2a404639b08882c57f3147229605dfd5 Mon Sep 17 00:00:00 2001 | |
From: Mike Frysinger <vapier@gentoo.org> | |
Date: Tue, 19 Apr 2016 06:50:31 -0400 | |
Subject: [PATCH] extlinux: pull in sys/sysmacros.h for major/minor/makedev | |
https://wiki.syslinux.org/wiki/index.php?title=Building | |
These functions are defined in sys/sysmacros.h, so add the include to | |
main.c. This is already handled correctly in mountinfo.c. Otherwise | |
we get build failures like: |
OlderNewer