Skip to content

Instantly share code, notes, and snippets.

Marius inferno7291

Block or report user

Report or block inferno7291

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@inferno7291
inferno7291 / promise.js
Last active Dec 31, 2018
Example promise javascript function
View promise.js
/* ES5, using Bluebird */
var isMomHappy = true;
// Promise
var willIGetNewPhone = new Promise(
function (resolve, reject) {
if (isMomHappy) {
var phone = {
brand: 'Samsung',
color: 'black'
@inferno7291
inferno7291 / youtube.js
Last active Nov 8, 2016
Youtube play on click image
View youtube.js
var i,c,y,v,s,n;
v = document.getElementsByClassName("youtube");
if(v.length>0){
s = document.createElement("style");
s.type="text/css";
s.innerHTML='.youtube{background-color:#000; max-width:100%;overflow:hidden;position:relative;cursor:hand;cursor:pointer}.youtube .ythumb{bottom:0;display:block;left:0;margin:auto;padding:0;max-width:100%;position:absolute;right:0;top:0;width:100%;height:auto}.youtube .play{filter:alpha(opacity=80);opacity:.8;left:50%;margin-left:-38px;margin-top:-38px;position:absolute;top:50%;width:77px;height:77px;background:url(http://lh6.googleusercontent.com/-KM0uGaLlhKc/UznnNWfT-wI/AAAAAAAAKS0/Nnz3WwdoLxk/s77/play.png) no-repeat}';
document.body.appendChild(s)}
for(n = 0; n < v.length; n++){
View otherThings.php.js
$this->languages['es'] = array(
'days' => array(1 => 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado','Domingo'),
'daysShort' => array(1 => 'Lun', 'Mar', 'Mie', 'Jue', 'Vie', 'Sab','Dom'),
'daysMin' => array(1 => 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sa','Do'),
'months' => array(1 => 'Enero','Febrero','Marzo','Abril','Mayo','Junio', 'Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'),
'monthsShort' => array(1 => 'Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Oct', 'Nov', 'Dic')
);
@inferno7291
inferno7291 / functions.php
Last active Feb 27, 2018
Function on PHP
View functions.php
/**
* Pasar de Kg a toneladas o al reves
*/
function formatKgtoTon($peso,$ton = false){
return $ton ? $peso*1000 : $peso/1000;
}
/**
* Formato europeo + separador decimal
@inferno7291
inferno7291 / dates.php
Last active Feb 27, 2018
Functions for date on PHP
View dates.php
/************************
* FUNCTION DATE
************************/
/**
* Devolver la fecha de hoy con o sin hora
*/
function dateToday($format = 'Y-m-d',$time = false){
$date = new DateTime();
return $time ? $date->format($format.' H:i:s') : $date->format($format);
}
@inferno7291
inferno7291 / functions.js
Last active Sep 19, 2016
Functions on javascript
View functions.js
/**
* Saber si es un numero
*/
function isNumeric(n) {
return !isNaN(parseFloat(n)) && isFinite(n);
}
/**
* Saber si es un integer
*/
@inferno7291
inferno7291 / clearForm.js
Last active Feb 27, 2018
Clear form javascript/jquery
View clearForm.js
/**
* Limpiar el formulario
*/
function clearForm(id_class_form) {
$(id_class_form).find(':input').each(function() {
switch(this.type) {
case 'password':
case 'select-multiple':
case 'select-one':
case 'text':
@inferno7291
inferno7291 / getJavascript.js
Created Sep 19, 2016
GET PHP on Javascript
View getJavascript.js
/**
* var name = $_GET('name');
* OR
* var $_GET = $_GET(), name = $_GET['name']
*/
function $_GET(param) {
var vars = {};
window.location.href.replace( location.hash, '' ).replace(
/[?&]+([^=&]+)=?([^&]*)?/gi, // regexp
function( m, key, value ) { // callback
@inferno7291
inferno7291 / passwordRand.js
Last active Sep 19, 2016
Generate password random JS/PHP
View passwordRand.js
#JS
function generatePasswordRand(length,type) {
switch(type){
case 'num':
characters = "0123456789";
break;
case 'alf':
characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
break;
case 'rand':
You can’t perform that action at this time.