Skip to content

Instantly share code, notes, and snippets.

@peterentwistle
peterentwistle / Constants.swift
Created June 1, 2015 21:04
In this third video I show you how constants work in Swift, and explain why they are important.
var str = "Hello, youtube"
let name = "Peter"
let a: Int = 42
@peterentwistle
peterentwistle / Variables.swift
Created May 31, 2015 13:13
In this second video I show you how variables work in Swift.
println("Hello World!")
var name: String
name = "Peter"
var x = 20
var y: Float = 5.2
var isEnabled: Bool = false
@peterentwistle
peterentwistle / HelloWorld.swift
Last active August 29, 2015 14:22
Swift Programming Basics - Intro - Part 1
println("Hello World!")
<?php
$dbCon = mysqli_connect("localhost", "root", "yourpasshere", "tutorials");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* check if server is alive */
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain user;killall Finder;echo "Open With has been rebuilt, Finder will relaunch"
@peterentwistle
peterentwistle / bcrypt-test.php
Created March 24, 2014 14:57
PHP Login System Part 3 - Code source
<?php
$options = array('cost' => 12);
echo "Bcrypt: ";
echo $hash = password_hash("password", PASSWORD_BCRYPT, $options);
echo "<br>";
echo "Verify now:<br>";
if (password_verify('password', $hash)) {
echo 'Password is valid!';
} else {
echo 'Invalid password.';
@peterentwistle
peterentwistle / hello.py
Created November 10, 2013 21:28
hello.py for the first tutorial
print "Hello World!"
@peterentwistle
peterentwistle / dbConnect.php
Last active December 17, 2015 03:49
The code for the second part of the basic PHP login tutorial.
<?php
$dbCon = mysqli_connect("localhost", "root", "yourpasshere", "tutorials");
?>
@peterentwistle
peterentwistle / index.php
Last active December 16, 2015 12:08
The code for the first basic login system tutorial.
<?php
session_start();
if (isset($_POST['username'])) {
// Set variables to represent data from database
$dbUsname = "Peter";
$dbPassword = "test1";
$uid = "1111";
// Set the posted data from the form into local variables
@peterentwistle
peterentwistle / index.html
Last active December 16, 2015 02:08
The source for the fourth tutorial index.html and style.css
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Youtube Tutorial - Peter</title>
<link rel="stylesheet" type="text/css" href="style/style.css">
</head>
<body>
<div id="pageWrapper">
<div id="header">