Skip to content

Instantly share code, notes, and snippets.

View FelisPhasma's full-sized avatar

FelisPhasma FelisPhasma

View GitHub Profile
@FelisPhasma
FelisPhasma / index.html
Last active October 2, 2018 21:32
Login with GitHub OAuth API simple implementation in PHP
<!-- other html... -->
<!-- be sure to enter your own client ID below -->
<a href="/path/to/login?login">login with github</a>
<!-- ... -->
@FelisPhasma
FelisPhasma / credit.txt
Last active August 30, 2016 23:38
Programming puns
Not all of these are mine, many are compiled from various sources online.
@FelisPhasma
FelisPhasma / errors.php
Created December 1, 2015 22:16
This code snippet will turn on all error reporting.
// This code snippet will turn on all error reporting.
ini_set('display_startup_errors',1);
ini_set('display_errors',1);
error_reporting(-1);
@FelisPhasma
FelisPhasma / ajax.js
Last active July 11, 2016 22:39
Making ajax super easy to use!
// Copyright (c) 2015 FelisPhasma
/*
Ussage:
ajax("GET", "url", true, function(status, responseText){
if (readyState==4 && status==200){
//...
}
})
*/
function ajax(method, url, async_, callback){
<?php
$file = 'records.log';
$person = "John Smith\n";
file_put_contents($file, $person, FILE_APPEND | LOCK_EX);
@FelisPhasma
FelisPhasma / HTMLEncode.js
Created March 8, 2015 00:07
Turns text into html special characters.
function HTMLEncode(str){
var ret = "";
for(i=0;i<str.length;i++){
ret = ret + "&#" + str.charCodeAt(i) + ";"
};
return ret;
};
@FelisPhasma
FelisPhasma / mailTest.php
Created March 7, 2015 17:34
testing php's mail function
<?php
# http://learn.koding.com/guides/enable-php-mail-function/
$to = 'felisphasma@gmail.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@felisphasma.koding.io' . "\r\n" .
'Reply-To: webmaster@felisphasma.koding.io' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
@FelisPhasma
FelisPhasma / requestAnimationFrame.js
Created September 16, 2014 22:06
requestAnimationFrame
window.requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(callback){
window.setTimeout(callback, 16.6);
};
@FelisPhasma
FelisPhasma / isMobile.js
Last active August 29, 2015 14:05
Detect if the user is on a mobile device.
window.isMobile = /iphone|ipod|ipad|android|blackberry|opera mini|opera mobi|skyfire|maemo|windows phone|palm|iemobile|symbian|symbianos|fennec/i.test(navigator.userAgent.toLowerCase());