Skip to content

Instantly share code, notes, and snippets.

@hipsterjazzbo
hipsterjazzbo / gist:54e06d4ef79c61f2a19b
Created January 20, 2015 07:37
Example of `elseif`
<?php
/**
* Pass in a number and get it back as a string with an ordinal suffix (1 -> 1st, 2 -> 2nd etc)
*/
function addSuffix($number)
{
if ($number == 1) {
return $number + 'st';
} elseif ($number == 2) {
<?php
$myStarSign = "Gemini";
if ($myStarSign == "Taurus") {
echo "Me too!";
} elseif ($mystarsign == "nah") {
echo "your dumb!";
} else {
echo "Too bad so sad...";
<?php
// One means "Assign this value to this variable"
$number = 1; // This one is an integer (whole number)
$anotherNumber = "1"; // This one is a string
// Two means "Are these the same value?"
if ($number == $anotherNumber) {
// This will be true
}
@hipsterjazzbo
hipsterjazzbo / solarized-colors.sh
Last active April 13, 2019 22:07
Solarized Colors as Bash Variables (ansi colors, xterm-256)
#!/bin/bash
BASE03="\[\033[38;5;234m\]"
BASE02="\[\033[38;5;235m\]"
BASE01="\[\033[38;5;240m\]"
BASE00="\[\033[38;5;241m\]"
BASE0="\[\033[38;5;244m\]"
BASE1="\[\033[38;5;245m\]"
BASE2="\[\033[38;5;254m\]"
BASE3="\[\033[38;5;230m\]"
@hipsterjazzbo
hipsterjazzbo / README.md
Last active March 18, 2019 01:24
Array intersect but good

PHP's array_intersect throws a fit if you only pass in one array cause it's a whiney baby. This one is good.

@hipsterjazzbo
hipsterjazzbo / directives.graphql
Last active May 18, 2023 02:37
A list of all the directive definitions for version 3.7 of https://github.com/nuwave/lighthouse
directive @all(
"""
Specify the class name of the model to use.
This is only needed when the default model resolution does not work.
"""
model: String
"""
Apply scopes to the underlying query.
"""
window.location.href = `v-for-wiki://${window.location.host}${window.location.pathname}`;