Skip to content

Instantly share code, notes, and snippets.

View yetti's full-sized avatar
🔌
Unplugged

Yetrina Battad yetti

🔌
Unplugged
View GitHub Profile
//echo $imagefullpath;
$img = ImageCreateFromJPEG($imagefullpath);
$canvas = imagecreatetruecolor($thumb_w,$thumb_h);
// following image calculation based on
// http://return-true.com/2009/02/making-cropping-thumbnails-square-using-php-gd/
$orig_w = imagesx($img);
$orig_h = imagesy($img);
$w_ratio = ($thumb_w / $orig_w);
$h_ratio = ($thumb_h / $orig_h);
if ($orig_w > $orig_h) { // horizontal image
@yetti
yetti / gist:4156394
Created November 27, 2012 19:21
RegEx to select "a href" from HTML
a\s*(?i)href\s*=\s*(\"([^"]*\")|'[^']*'|([^'">\s]+))
@yetti
yetti / content.css
Created December 3, 2012 08:23
css fixes
.content {
background: #EFEEEA url(../img/body-bg.png) repeat-y 0 0;
background-size: 100%;
padding: 100px 24px 120px;
margin: 0 0 -30px;
}
@yetti
yetti / computed.css
Last active December 13, 2015 18:39
computed css
border-collapse: collapse;
color: rgb(0, 0, 0);
display: block;
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
font-weight: bold;
height: 18px;
line-height: 17px;
margin-bottom: 0px;
margin-left: 0px;
@yetti
yetti / aether_lead-in_block.rb
Created March 20, 2013 13:18
Provides a {% lead %} block to define lead-in text. Adds text inside block to post data's 'lead' field and wraps text inside a paragraph with a style class for customisation.
# Title: Lead-in Text Block
# Author: Yetrina Battad (http://aether.nu)
# Description: Provides a block for lead-in text. Inspired by this plugin: http://blog.darkrefraction.com/2012/jekyll-excerpt-plugin.html
#
# Captures the text between the 'lead' block and places it in the post data's 'lead' property.
# Also wraps the text between the 'lead' tags into a paragraph with CSS hook for styling.
#
# Usage:
# {% lead %}
# Wheeee!
@yetti
yetti / Package Control.py
Created April 23, 2013 10:43
Fixes installation issue in Sublime Package Control for packages with null versions.
try:
new_version = 'v' + download['version']
except:
print '%s: Error parsing JSON from repository %s.' % (info.get('name'), self.repo)
print '%s: Download version is null.' % (info.get('name'))
@yetti
yetti / html5-placeholders.html
Created May 29, 2013 21:37
modernizr + placeholders.js polyfill
<script src="modernizr.js"/>
<script src="Placeholder.js"/>
<script>
Modernizr.load({
test: Modernizr.input.placeholder,
nope: ['Placeholder.js'],
complete: function(){Placeholders.init();}
});
</script>
@yetti
yetti / git log alias
Created June 8, 2013 02:58
pretty git logs in the console
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
# Secure the server:
# https://library.linode.com/securing-your-server
# Install essential stuff
apt-get update
apt-get upgrade
apt-get install build-essential
apt-get install git
apt-get install zsh
apt-get install zlib1g-dev # Dependency for bundler
<div class="section group">
<div class="col span_1_of_6">
1 of 6
</div>
<div class="col span_1_of_6">
1 of 6
</div>
<div class="col span_1_of_6">
1 of 6
</div>