Skip to content

Instantly share code, notes, and snippets.

@marcialca
marcialca / gist:4527901
Created January 14, 2013 05:14
[CSS] Faux Gradient using an Image and CSS
From: http://webdesign.tutsplus.com/tutorials/visuals/quick-tip-using-images-as-fullscreen-faux-gradient-backgrounds/
1. Use a 300x300 img
2. Apply a gaussian blur with a radious of 40 or more
3. Apply the CSS
body{
margin: 0;
background: url('img/bg.jpg');
background-size: 100% 100%;
background-attachment: fixed;
@marcialca
marcialca / gist:4151769
Created November 27, 2012 01:17
[MYSQL]WP from local to server
UPDATE wp_options SET option_value = replace(option_value, 'http://localhost:8888/wordpress', 'http://www.YOUR_SITE_URL.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = REPLACE (guid, 'http://localhost:8888/wordpress', 'http://www.YOUR_SITE_URL.com');
UPDATE wp_posts SET post_content = REPLACE (post_content, 'http://localhost:8888/wordpress', 'http://www.YOUR_SITE_URL.com');
UPDATE wp_postmeta SET meta_value = REPLACE (meta_value, 'http://localhost:8888/wordpress','http://www.YOUR_SITE_URL.com');
@marcialca
marcialca / gist:4068430
Created November 13, 2012 21:12
Ubuntu reinstall process
##Ubuntu Reinstall progres
1. Install / and /home apart, so it's easier to make a reinstall
2. Backup all packages!
2.1. Create a REINSTALL directory in your Home. The type in Terminal in the directory:
sudo apt-get update
dpkg --get-selections > /REINSTALL/installed-programs.log
2.2. Save you GPG keys
@marcialca
marcialca / gist:4043136
Created November 9, 2012 01:26
[CSS] Px to Em based on Context
target ÷ context = result
If we assume the body’s default type size to be 16px, we can plug each desired font-size value into this formula. So to properly match our header to the comp, we divide the target value (24px) by the font-size of its container (16px):
24 ÷ 16 = 1.5
So the header is 1.5 times the default body size, or 1.5em, which we can plug directly into our stylesheet.
h1 {
font-family: Georgia, serif;
font-size: 1.5em; /* 24px / 16px = 1.5em */
}
@marcialca
marcialca / gist:4043134
Created November 9, 2012 01:25
[CSS] Full Width Textareas
textarea {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
width: 100%;
}
Setting the box-sizing to border-box allows the textarea to respect its parent container's padding and border, recalculating what 100% actually means. If the box-sizing were content-box, the textarea would continue to stretch outside the parent container as it would have before.
@marcialca
marcialca / gist:4043123
Created November 9, 2012 01:22
[Rails] Can’t connect to MySQL server on ‘localhost’
My simple work around was going to config/database.yml file and changing the host to use 127.0.0.1 instead of localhost as follows.
development:
adapter: mysql2
encoding: utf8
reconnect: false
database: quiz_development
pool: 5
username: root
password:
@marcialca
marcialca / gist:4043119
Created November 9, 2012 01:20
[Rails] Rails + XAMPP + Windows + MySQL
gem install mysql2 -- --with-mysql-include=C:\xampp\mysql\include --with-mysql-lib=C:\xampp\mysql\lib\opt
At the time of building this gem, the necessary DLL files where available
in the following download:
http://dev.mysql.com/get/Downloads/Connector-C/mysql-connector-c-noinstall-6.0.2-win32.zip/from/pick
And put lib\libmysql.dll file in your Ruby bin directory, for example
C:\Ruby\bin
@marcialca
marcialca / gist:4043107
Created November 9, 2012 01:18
[CSS] Click Event CSS3
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title></title>
<style>
figure { background: #e3e3e3; display: block; float: left;}
#zoom {
width: 200px;
-webkit-transition: width 1s;
@marcialca
marcialca / gist:4043102
Created November 9, 2012 01:17
[Rails] Ruby on Rails XAMPP MySQL config
gem install mysql2 -- --with-mysql-include=C:\xampp\mysql\include --with-mysql-lib=C:\xampp\mysql\lib\opt
@marcialca
marcialca / gist:4043090
Created November 9, 2012 01:14
[CSS]CSS Count Increment
.box {
counter-increment: boxes;
}
The counter-increment property can accept either one or two properties. The first is an id that you will later use to reference this specific counter. You may also pass a second parameter that refers to the increment. For example, instead of 1, 2, 3, 4, you could switch to 5, 10, 15, 20 by applying: counter-increment: boxes 5.
This code will now store a unique number for each element that has a class of box. But of course, we want to get this number on the page. Hopefully, we’ll, at some point in the future, be able to use the content property within standard selectors, but not quite yet. Instead, we’ll use pseudo elements to apply the content.
.box:after {
content: counter(boxes);
}