Skip to content

Instantly share code, notes, and snippets.

View daigofuji's full-sized avatar

Daigo Fujiwara daigofuji

View GitHub Profile
@daigofuji
daigofuji / landscape.html
Created April 12, 2012 01:35
Super simple css for “Hey, turn your phone around and you can see this better!” notification for mobile devices.
<html>
<head>
<style type="text/css">
#g-landscape {display:none; margin:0 auto;font-family: sans-serif; font-size:10px;}
@media only screen and (max-device-width: 800px) and (orientation:portrait) {
#g-landscape {display:block;}
}
</style>
</head>
<body>
@daigofuji
daigofuji / read_Yahoo_pipes.php
Created April 12, 2012 17:01
Get Pipes jason and process it using php
$yahooPipesURL = "http://pipes.yahoo.com/pipes/pipe.run?_id=89dba5fe8716d4e780a80206edda2da6&_render=json";
// the old way
//$session = curl_init($yahooPipesURL);
//curl_setopt($session, CURLOPT_HEADER, false);
//curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
//$resultsJson = curl_exec($session);
//curl_close($session);
// the new way
@daigofuji
daigofuji / gist:2966774
Created June 21, 2012 16:12
PHP LANGUAGE DETECTION
<?php
/*
PHP LANGUAGE DETECTION SCRIPT
written by Mischa Szeker (www.szeker.ch)
January 21, 2011
http://www.szeker.net/2011/02/10/php-language-detection-script/
*/
/* Setting variables */
@daigofuji
daigofuji / gist:3168075
Created July 24, 2012 04:39
Quick tool tip (State of Rivalry)
<style>
#tooltip { padding: 5px; width: auto; min-width:78px; background-color:#fff; border: 2px #ccc solid; position: absolute; top: 50px; z-index:1000; font-size:12px; text-transform:uppercase; text-align:left; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px;}
#tooltip .tip, #tooltip .tip-inner { position: absolute; width:0; height:0; border-top-width: 0; background: none; }
#tooltip .tip { border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 7px solid #ccc; top: -7px; right: auto; left: 50%; margin-left: -5px; }
#tooltip .tip-inner { border-left: 4px solid transparent; border-right: 4px solid transparent; border-bottom: 7px solid #fff; bottom: auto; top: 2px; left: -4px; }
</style>
<script>
$(".game").hover( function () {
$("#tip-wpit").text($(this).attr("data-wpit"));
$("#tip-lpit").text($(this).attr("data-lpit"));
@daigofuji
daigofuji / gist:3196205
Created July 29, 2012 05:12
Bootstrap select
select {
margin: 0;
vertical-align: middle;
font-weight: normal;
display: inline-block;
width: 210px;
height: 18px;
padding: 4px;
margin-bottom: 9px;
font-size: 13px;
@daigofuji
daigofuji / gist:3364434
Created August 15, 2012 22:52
Number format
function number_format (number, decimals, dec_point, thousands_sep) {
// https://raw.github.com/kvz/phpjs/master/functions/strings/number_format.js
// Strip all characters but numerical ones.
number = (number + '').replace(/[^0-9+\-Ee.]/g, '');
var n = !isFinite(+number) ? 0 : +number,
prec = !isFinite(+decimals) ? 0 : Math.abs(decimals),
sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep,
dec = (typeof dec_point === 'undefined') ? '.' : dec_point,
s = '',
toFixedFix = function (n, prec) {
@daigofuji
daigofuji / Responsive-CSS3-animation.html
Created January 22, 2013 20:35
CSS3 animation simplified. Wanted to deconstruct http://bradfrost.github.com/this-is-responsive/
<!DOCTYPE html>
<html>
<head>
<title>Responsive CSS3 animation. Look! No JavaScript!</title>
<style type="text/css" title="text/css">
<!--
html, body {
margin: 0; padding: 0; height:100%; /* in order for height 100% to work, you need to set html and body to match. then you need to use iframe to add it to the html */
font-family: "Century Gothic", "Tw Cen MT", Futura, "URW Gothic L", Arial, sans-serif;
}
@daigofuji
daigofuji / AutoYear.html
Created March 16, 2013 02:30
Too lazy updating curent year for the copyright at the bottom of the page? So am I.
<p>Copyright &copy; <script type="text/javascript">var d = new Date();document.write(d.getFullYear());</script></p>
@daigofuji
daigofuji / WP custom login
Last active December 18, 2015 08:00
Customizing wordpress "login screen." Add this to wp-content/themes/YOUR_THEME_FOLDER/functions.php
// Custom login page. Modifying logo image, link and title.
function my_custom_login_logo() {
echo '<style type="text/css"> h1 a { background-image:url('.get_stylesheet_directory_uri().'/img/MYLOGO.png) !important; }</style>';
}
add_action('login_head', 'my_custom_login_logo');
function namespace_login_headerurl( $url ) {
$url = get_bloginfo( 'url' );
return $url;
}