Skip to content

Instantly share code, notes, and snippets.

@nitestryker
nitestryker / for
Created April 28, 2015 04:40
for loop
<?php
for ($x = 0; $x <= 10; $x++) {
echo "The number is: $x <br>";
}
?>
@nitestryker
nitestryker / 0_reuse_code.js
Created August 11, 2014 20:28
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@nitestryker
nitestryker / expire time
Last active August 29, 2015 14:04
calculate expire time
<?php
$post_exp = $_POST['post_exp'];
/*
expire codes
0 = never expire (not used in switch)
1 = 10 mins
2 = 1 hour
3 = 1 day
4 = 1 month
*/
@nitestryker
nitestryker / email validator.php
Created May 18, 2013 23:24
validates email first by a syntax check and then by checking if the host exist
<?php
$email="email@thisemailisnotvaild.com";
if (isValidEmail($email))
{
echo "Hooray! Adress is correct.";
}
else
{
echo "Sorry! No way.";
}
@nitestryker
nitestryker / .httaccess
Last active December 17, 2015 05:39
httaccess
# Current .htaccess file (07-25-14)
Options +FollowSymLinks
RewriteEngine ON
RewriteCond %{HTTP_HOST} ^127.0.0.1
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) http://domain.com/pbclone/post.php?pid=$1 [R=301,L]
# raw format
RewriteRule ^raw/([^/.]+)/?$ /pbclone/raw/raw.php?rid=$1 [L]
# users profiles
<?PHP
// don't timeout
set_time_limit (0);
// set some variables
$host = "127.0.0.1";
$port = "5552";
// create socket
$socket = socket_create(AF_INET, SOCK_STREAM, 0) or die("Could not create socket\n");