Skip to content

Instantly share code, notes, and snippets.

View JonDotsoy's full-sized avatar

Jonathan Delgado JonDotsoy

View GitHub Profile
<head>
<meta charset="UTF-8">
<title>MemoColor</title>
<link rel="stylesheet" href="...">
<style>
.demoColor {
height: 100px;
}
</style>
</head>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
@JonDotsoy
JonDotsoy / fechaCompara.cs
Created July 19, 2014 21:51
Genera la diferencia entre dos fechas.
using System;
namespace datetest
{
class MainClass
{
public static string diffStr(DateTime desde, DateTime asta) {
TimeSpan tsDiff = diff(desde,asta);
DateTime deteDiff = new DateTime(1,1,1);
deteDiff = deteDiff.Add(tsDiff);
acron: function(dateIn,dateFrom) {
if (typeof dateIn) dateIn = new Date(dateIn);
if (!dateFrom) dateFrom = new Date();
if (!dateIn) dateIn = new Date();
var out = '',diff = dateFrom - dateIn;
if (diff > (365*24*60*60*1000)) {
out = (diff/(365*24*60*60*1000)).toFixed(0)+"y";
} else if (diff > (24*60*60*1000)) {
out = (diff/(24*60*60*1000)).toFixed(0)+"d";
} else if (diff > (60*60*1000)) {
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<div class="ratio ratio-1by1">
<img src="http://lorempixel.com/600/1200/food" data-model="width" alt="" class="ratio-item">
</div>
@JonDotsoy
JonDotsoy / FullModel.php
Last active August 29, 2015 14:05
Formato de fechas para Modelo Laravel
<?php
class Comment extends Eloquent
{
public function format_time() {
$dateIn = strtotime($this->updated_at);
$dateFrom = time();
$out = '';
$diff = $dateFrom - $dateIn;
if ($diff > (365*24*60*60)) {
public int getSumaConsecutivaInpares(int nSuma) {
int sumatoria = 0;
for (int i = 0 ; i <= nSiclo ; i++) {
// Busca si es impar
if ((i%2) == 1) {
sumatoria = sumatoria + i;
}
}
public int getSumaConsecutivaInpares() {
int nSuma = 4;
int sumatoria = 0;
for (int i = 0 ; i <= nSiclo ; i++) {
// Busca si es impar
if ((i%2) == 1) {
sumatoria = sumatoria + i;
}