Skip to content

Instantly share code, notes, and snippets.

psdtohtml5

Block or report user

Report or block psdtohtml5

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@psdtohtml5
psdtohtml5 / snippet.html
Created Oct 17, 2013
HTML : Wai-Aria template
View snippet.html
<!doctype html>
<html>
<head>
<title>Title of your document</title>
<meta charset="utf-8">
<meta name="description" content="">
</head>
<body>
@psdtohtml5
psdtohtml5 / snippet.js
Created Oct 15, 2013
JavaScript : Add Business days to a date
View snippet.js
// https://github.com/lsmith/addBusinessDays/blob/master/addBusinessDays.js
// var d = new Date();
// addBusinessDays(d, numberOfDays);
function addBusinessDays(d,n) {
d = new Date(d.getTime());
var day = d.getDay();
d.setDate(d.getDate() + n + (day === 6 ? 2 : +!day) + (Math.floor((n - 1 + (day % 6 || 1)) / 5) * 2));
return d;
}
@psdtohtml5
psdtohtml5 / snippet.txt
Created Aug 21, 2013
OPENSSL : Base64 Encode
View snippet.txt
openssl base64 < path/to/file.png | tr -d '\n' | pbcopy
@psdtohtml5
psdtohtml5 / snippet.php
Created Aug 17, 2013
PHP : Laravel 4 Database transactions
View snippet.php
try {
DB::connection()->getPdo()->beginTransaction();
// database queries here
DB::connection()->getPdo()->commit();
} catch (\PDOException $e) {
// Woopsy
DB::connection()->getPdo()->rollBack();
}
@psdtohtml5
psdtohtml5 / snippet.php
Created Aug 17, 2013
PHP : Laravel 3 Database Transactions
View snippet.php
try {
DB::connection()->pdo->beginTransaction();
// database queries here
DB::connection()->pdo->commit();
} catch (\PDOException $e) {
// Woopsy
DB::connection()->pdo->rollBack();
}
@psdtohtml5
psdtohtml5 / snippet.html
Created Aug 15, 2013
CSS : Sticky footer , Footer at bottom
View snippet.html
<!-- SINGLE COLUMN LAYOUT -->
<div id="wrap">
<header id="header"></header>
<section id="main"></section>
</div>
<footer id="footer"></footer>
<!-- MULTI COLUMN LAYOUT -->
<div id="wrap">
<header id="header"></header>
@psdtohtml5
psdtohtml5 / snippet.js
Created Aug 12, 2013
JavaScript : Scroll and Focus to Element (input)
View snippet.js
var cursorFocus = function(elem) {
var x = window.scrollX, y = window.scrollY;
window.scrollTo(x, y);
elem.focus();
}
cursorFocus(document.getelementbyId('search-terms'));
View gist:6156480
<script>
showMap([
{
target: "map-canvas",
locations: [
["Saved Home 1",-25.363882,131.040922],
["Saved Home 2",-25.363882,131.044922],
["Saved Home 3",-25.363882,131.048922],
["Saved Home 4",-25.363882,131.052922],
["Saved Home 5",-25.363882,131.056922],
@psdtohtml5
psdtohtml5 / gist:6114930
Created Jul 30, 2013
PHP : Extract image source from HTML
View gist:6114930
$doc = new DOMDocument();
$doc->loadHTML($html);
$tags = $doc->getElementsByTagName('img');
foreach ($tags as $tag) {
echo $tag->getAttribute('src');
}
View gist:6114544
function getRealIpAddr()
{
if (!empty($_SERVER['HTTP_CLIENT_IP']))
//check ip from share internet
{
$ip=$_SERVER['HTTP_CLIENT_IP'];
}
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
//to check ip is pass from proxy
{
You can’t perform that action at this time.