Skip to content

Instantly share code, notes, and snippets.

View MilkZoft's full-sized avatar

Carlos Santana Roldán MilkZoft

View GitHub Profile
@MilkZoft
MilkZoft / url.js
Created January 16, 2012 04:37
code.jobs - Get URL parameters - jQuery
$.urlParam = function(name) {
var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);
if(!results) {
return 0;
}
return results[1] || 0;
}
@MilkZoft
MilkZoft / browser.js
Created January 16, 2012 04:33
code.jobs - Test if the browser supports a specific CSS3 property - jQuery
var supports = (function() {
var div = document.createElement('div'),
vendors = 'Khtml Ms O Moz Webkit'.split(' '),
len = vendors.length;
return function(prop) {
if(prop in div.style) {
return true;
}
@MilkZoft
MilkZoft / column.js
Created January 16, 2012 04:18
code.jobs - Equal column height - jQuery
var maxHeight = 0;
$("div.col").each(function() {
if($(this).height() > maxHeight) {
maxHeight = $(this).height();
}
});
$("div.col").height(maxHeight);
@MilkZoft
MilkZoft / fade.js
Created January 16, 2012 04:13
code.jobs - Fade in/out on hover - jQuery
$(document).ready(function() {
$(".thumbs img").fadeTo("slow", 0.6); //This sets the opacity of the thumbs to fade down to 60% when the page loads
$(".thumbs img").hover(function() {
$(this).fadeTo("slow", 1.0); //This should set the opacity to 100% on hover
}, function() {
$(this).fadeTo("slow", 0.6); //This should set the opacity back to 60% on mouseout
});
});
@MilkZoft
MilkZoft / images.js
Created January 16, 2012 03:48
Preloading images
(function($) {
var cache = [];
$.preLoadImages = function() {
var argsLen = arguments.length;
for(var i = argsLen; i--;) {
var cacheImage = document.createElement('img');
cacheImage.src = arguments[i];
@MilkZoft
MilkZoft / word.php
Created January 16, 2012 02:50
code.jobs - Word Count - PHP
<?php
function wordCount($text) {
$words = explode(" ", $text);
return count($words);
}
$words = wordCount("Welcome to code.jobs");
print $words;
@MilkZoft
MilkZoft / hello.html
Created January 14, 2012 19:32
code.jobs - Hello World - jQuery
<!DOCTYPE html>
<html>
<head>
<title>jQuery Hello World</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
</head>
<body>
<script type="text/javascript">
@MilkZoft
MilkZoft / index.html
Created January 14, 2012 19:18
code.jobs - My first web page in HTML5 - HTML5
<!DOCTYPE html>
<html lang="en">
<head>
<title>My first web page</title>
</head>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
@MilkZoft
MilkZoft / hola.cpp
Created January 14, 2012 18:14
code.jobs - Hola Mundo - C++
#include <iostream>
using namespace std;
void main() {
cout << "Hola Mundo!" << endl;
}
@MilkZoft
MilkZoft / hola.sh
Created January 14, 2012 17:59
code.jobs - Hola Mundo - Bash
#!/bin/bash
echo "Hola Mundo!"