Skip to content

Instantly share code, notes, and snippets.

@enlacee
enlacee / query_date.sql
Created May 3, 2014 09:30
MYSQL DATE : filtro por intervalo desde ahora hasta hace 1 dia.
-- Filtro por intervalo desde ahora hasta hace 1 dia
SELECT
slots.slot,
slots.name,
slots.min,
slots.max,
AVG(datos.valor) valor
FROM slots
@enlacee
enlacee / ModuleZF2.php
Created April 7, 2015 23:52
ZF2 Configuration of helper for VIEW AND CONTROLLER : module.php
<?PHP
/*
* Return url purify (URL clean for SEO)
* This function is posible call for:
* // CONTROLLER
* $utilFunction = $this->helper->get('utilFunction');
*
* // VIEW
* $utilFunction = $this->plugin("utilFunction");
*/
@pung96
pung96 / gist:2549001
Created April 29, 2012 09:30
Youtube2Mp3
javascript:function cMp3(){
var cUrl=location.href;
var yPar=(cUrl.match(/v=([a-zA-Z0-9_\-]*)/))[1];
var nUrl="http://dirpy.com/studio/"+yPar
+"? album=youtube&srcfmt=18&comment=youtube,"
+encodeURIComponent("http://www.youtube.com/watch?v="+yPar);
window.open(nUrl,"_blank");
};
cMp3();
@zosiu
zosiu / xdg-open
Created December 5, 2013 21:06
Patched /usr/bin/xdg-open script for Lubuntu to open magnet and sublime links.
#!/bin/sh
#---------------------------------------------
# xdg-open
#
# Utility script to open a URL in the registered default application.
#
# Refer to the usage() function below for usage.
#
# Copyright 2009-2010, Fathi Boudra <fabo@freedesktop.org>
# Copyright 2009-2010, Rex Dieter <rdieter@fedoraproject.org>
@enlacee
enlacee / set-scroll-conten-jquery.js
Created August 29, 2017 22:30
hacer scroll con el tamaño de cabecera
function getHeightHeader() {
var height = 0;
if ($('.header-page').length === 1) {
$headerPage = $('.header-page');
if ($headerPage.css('position') === 'fixed') {
height = $headerPage.height();
}
}
return height;
}
@gbakernet
gbakernet / load-google-maps.js
Created February 15, 2011 23:42
Load Google Maps API using jQuery Deferred.
/*!
* JavaScript - loadGoogleMaps( version, apiKey, language )
*
* - Load Google Maps API using jQuery Deferred.
* Useful if you want to only load the Google Maps API on-demand.
* - Requires jQuery 1.5
*
* Copyright (c) 2011 Glenn Baker
* Dual licensed under the MIT and GPL licenses.
*/
@alizhdanov
alizhdanov / scrollTop.js
Created August 21, 2016 20:03
pure javascript scrollTop function
function scrollTo(element, to, duration) {
if (duration < 0) return;
var difference = to - element.scrollTop;
var perTick = difference / duration * 2;
setTimeout(function() {
element.scrollTop = element.scrollTop + perTick;
scrollTo(element, to, duration - 2);
}, 10);
}
@happycollision
happycollision / Vagrantfile
Created January 17, 2014 06:48
A nice little Vagrantfile that spins up a MySQL server and loads in the data from your .sql file sitting next to it.
# -*- mode: ruby -*-
# vi: set ft=ruby :
# This Vagrantfile (vagrantup.com) spins up a MySQL server with your data
# already loaded. Many of the settings below are the same suggestions you get
# from `vagrant init`.
#
# Just be sure that (if you want data loaded) you have your .sql file sitting
# in the directory that will be shared to the guest. Usually this is the folder
# that your Vagrantfile is in. The database and user will have the same name as
@joshhartman
joshhartman / mcrypt-cbc.php
Last active April 20, 2022 08:44
Rijndael 256-bit Encryption Function (CBC)
<?php
// Define a 32-byte (64 character) hexadecimal encryption key
// Note: The same encryption key used to encrypt the data must be used to decrypt the data
define('ENCRYPTION_KEY', 'd0a7e7997b6d5fcd55f4b5c32611b87cd923e88837b63bf2941ef819dc8ca282');
// Encrypt Function
function mc_encrypt($encrypt, $key){
$encrypt = serialize($encrypt);
$iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC), MCRYPT_DEV_URANDOM);
$key = pack('H*', $key);
@christopher-baek
christopher-baek / .Configure ddclient with Namecheap.md
Last active April 20, 2023 21:21
Configure ddclient withNamecheap

Configure ddclient with Namecheap

Namecheap Configuration

  1. Click the Manage button next to the domain in the Domain List view
  2. In the Domain tab, scroll down and remove any entries in the Redirect Domain list
  3. In the Advanced DNS tab...
  4. Turn on Dynamic DNS and make a note of the password
  5. Add an A Record for @ pointing to 127.0.0.1