Skip to content

Instantly share code, notes, and snippets.

View Wh04m1x's full-sized avatar

Mrjoshua Wh04m1x

  • AGR
  • QUERETARO, MEXICA
View GitHub Profile
//row markup
$row = '<div class="row-fluid">%s</div>'
//$posts = whatever you are trying to put in a grid.
$span_divs = array();
foreach ( $posts as $post ) {
//make a span box
$span_divs[] = sprintf( "<div class="span4">%s</div>" , $post);
}
//chunk the array of grid items into a number if items
@jomasero
jomasero / ordenarSelect.htm
Created June 24, 2013 20:24
Ordenar alfabéticamente una lista dentro de un select que viene desordenada.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script>
function ordenarSelect(id_componente)
{
var selectToSort = jQuery('#' + id_componente);
var optionActual = selectToSort.val();
@jrobinsonc
jrobinsonc / number-format.js
Last active July 23, 2021 22:09
Funcion para darle formato a un número. #javascript #numbers
function number_format(amount, decimals) {
amount += ''; // por si pasan un numero en vez de un string
amount = parseFloat(amount.replace(/[^0-9\.]/g, '')); // elimino cualquier cosa que no sea numero o punto
decimals = decimals || 0; // por si la variable no fue fue pasada
// si no es un numero o es igual a cero retorno el mismo cero
if (isNaN(amount) || amount === 0)
return parseFloat(0).toFixed(decimals);