Skip to content

Instantly share code, notes, and snippets.

View cmertayak's full-sized avatar

CM cmertayak

View GitHub Profile
@jeremydouglas
jeremydouglas / SVG Replacement
Last active August 29, 2015 13:57
SVG Replacement
// Automatically replace SVG images on non-supporting browsers
if (!Modernizr.svg || !Modernizr.inlinesvg)
{
$('img.svg').each(function()
{
this.src = this.src.replace('.svg', '.png');
$(this).addClass('svg_loaded');
});
}
@rosenhub
rosenhub / Coupon
Created March 4, 2014 20:22
Coupon looking box in CSS
The HTML
<div id="container">
<h2>$10 Off</h2>
</div>
The CSS
h2 {
font-size: 80px;
@rosenhub
rosenhub / Text small caps
Created March 4, 2014 20:21
Text into small caps w/CSS
The HTML
<div id="container">
<p>Small Caps</p>
</div>
The CSS
#container p {
text-align: center;
@shalaby
shalaby / detectLocationByIP.php
Created March 4, 2014 20:10
Detect location by IP
function detect_city($ip) {
$default = 'UNKNOWN';
if (!is_string($ip) || strlen($ip) < 1 || $ip == '127.0.0.1' || $ip == 'localhost')
$ip = '8.8.8.8';
$curlopt_useragent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)';
$url = 'http://ipinfodb.com/ip_locator.php?ip=' . urlencode($ip);
@tulioti
tulioti / MySQL Backup
Created March 4, 2014 20:06
MySQL Backup
#!/usr/bin/env ruby
require 'mail'
mysql_username = 'root'
mysql_password = '123456'
mysql_database = 'test'
system("mysqldump --user=#{mysql_username} --password=#{mysql_password} #{mysql_database} > backup.sql")
# Credit to :
class Class:
pass
def say_hello(self):
print "Hello"
Class.say_hello = say_hello
Class().say_hello()
@lucasfais
lucasfais / gist:1207002
Created September 9, 2011 18:46
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt