Skip to content

Instantly share code, notes, and snippets.

View komputronika's full-sized avatar

Komputronika komputronika

View GitHub Profile
@dahnielson
dahnielson / UUID.php
Last active April 5, 2024 21:14
Pure PHP UUID generator
<?php
/**
* UUID class
*
* The following class generates VALID RFC 4122 COMPLIANT
* Universally Unique IDentifiers (UUID) version 3, 4 and 5.
*
* UUIDs generated validates using OSSP UUID Tool, and output
* for named-based UUIDs are exactly the same. This is a pure
* PHP implementation.
@xtian
xtian / html5boilerplate.jade
Last active December 23, 2023 15:05
HTML5 Boilerplate in jade
!!! 5
html(class='no-js')
head
meta(charset='utf-8')
meta(http-equiv='X-UA-Compatible', content='IE=edge')
title
meta(name='description', content='')
meta(name='viewport', content='width=device-width, initial-scale=1')
@xeoncross
xeoncross / timezone.php
Created September 8, 2011 18:43
The perfect TimeZone selectbox list for PHP 5.3+
<?php
$regions = array(
'Africa' => DateTimeZone::AFRICA,
'America' => DateTimeZone::AMERICA,
'Antarctica' => DateTimeZone::ANTARCTICA,
'Aisa' => DateTimeZone::ASIA,
'Atlantic' => DateTimeZone::ATLANTIC,
'Europe' => DateTimeZone::EUROPE,
'Indian' => DateTimeZone::INDIAN,
'Pacific' => DateTimeZone::PACIFIC
@xhezairbey
xhezairbey / bitly_api_v3_shorten.php
Created October 27, 2011 23:42
BitLy API v3 Shorten PHP
<?php
function bitly_shorten($url) {
$login = "bitly_login";
$apikey = "bitly_apikey";
$format = "json";
$query = array("login" => $login,
"apiKey" => $apikey,
"longUrl" => urlencode($url),
"format" => $format);
@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
<?php
// Usage:
// $master=new WebSocket("localhost",12345);
// $master->callback = function($self, $user, $msg){
// $self->send($user->socket,$msg);
// };
require "CommandsAppBase.class.php";
require "WsRequest.class.php";
@gentlecat
gentlecat / cloudflare.php
Last active October 23, 2022 10:13
CloudFlare DNS records updater
<?php
/**
* Settings
*/
define('API_KEY', $_GET['apikey']); // CloudFlare API key
define('USERNAME', 'user@example.com'); // Email address used to login into CloudFlare
define('IP', getCurrentIP()); // Current IP address
echo 'Setting IP address to "' . IP . '"...<br />';
@Jxck
Jxck / server.js
Created July 24, 2012 17:09
WebSocket Server Sample Impliment
// Reference
// http://tools.ietf.org/html/rfc6455
// http://www.w3.org/TR/2011/WD-websockets-20110929/
// https://github.com/einaros/ws
// https://github.com/Worlize/WebSocket-Node
// http://ja.wikipedia.org/wiki/WebSocket
// http://www.slideshare.net/You_Kinjoh/javascript-websocket P.68
// http://d.hatena.ne.jp/gtk2k/20120203/1328274962
var log = console.log.bind(console);
@DamianMullins
DamianMullins / gist:3452075
Last active March 23, 2023 11:44
Increment or decrement textbox value using arrow up & down keyboard keys
function change(element, increment) {
var $el = $(element),
elValue = parseInt($el.val(), 10),
incAmount = increment || 1,
newValue = elValue + incAmount;
if ((newValue) > -1) {
$el.val(newValue);
}
}
@shakyShane
shakyShane / html5-number-polyfill.html
Created November 7, 2012 19:23
Increment/Decrement an 'amount' input.
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
</head>
<body>