View emoji.php
<?php
$animals = [
'dog' => '🐶',
'cat' => '🐱',
'mouse' => '🐭'
];
?>
<script>
let wildAnimals = {
View Javascript ES6|ES2015.md

JavaScript ES6/ES2015

Block scope

  • let - assigns a new variable that can be overwritten with any type

  • const - assigns a new variable that can not be overwritten; however, non-scalar values can be modified (immutable variables, not really traditional constants)

Functions can also be block-scoped

View .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
# !IMPORTANT! Set your RewriteBase here and don't forget trailing and leading
# slashes.
# If your page resides at
# http://www.example.com/mypage/test1
# then use
# RewriteBase /mypage/test1/
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
View ex16-extra-credit.c
#include <stdio.h>
typedef struct {
char *name;
int age;
int height;
int weight;
} Person;
Person Person_create(char *name, int age, int height, int weight)
View .zshrc
# correction
setopt correctall
#prompt
autoload -U promptinit
promptinit
prompt clint
View .osx
# ~/.osx — http://mths.be/osx
###############################################################################
# General UI/UX #
###############################################################################
# Menu bar: disable transparency
defaults write NSGlobalDomain AppleEnableMenuBarTransparency -bool false
# Always show scrollbars
View GetSet.php
<?php
/**
* Trait to get rid of naive getter/setter boilerplate
*/
trait GetSet
{
/**
* Dynamically create getters/setters
View custom_error_handler.php
<?php
/**
* Function to run on script shutdown
* -used to catch most fatal errors, and
* display them cleanly
*
* @return void
*/
function shutdown()
View images.php
<?php
function do_curl($url, $options=array())
{
$cookie = tempnam ("/tmp", "CURLCOOKIE");
$ch = curl_init($url);
//Use the user's User Agent and Cookies
$opts= array(
CURLOPT_USERAGENT => "Tim's List Image Updater",
CURLOPT_COOKIEJAR => $cookie,
View loops.php
<?php
// Normal foreach loop
foreach($foo as $bar)
{
...
}
// Foreach with reference
foreach($foo as &$bar)