Skip to content

Instantly share code, notes, and snippets.

View Jehu's full-sized avatar

Marco Michely Jehu

View GitHub Profile
@saschagehlich
saschagehlich / i18n.coffee
Created September 14, 2010 00:48
Simple i18n with node.js and express.js
exports.I18n =
en:
title: "Free YouTube video download"
navi:
home: "Home"
howto: "Tutorial"
blog: "Blog"
termsofuse: "Terms of Use"
support: "Support"
imprint: "Imprint"
@imelgrat
imelgrat / check-youtube-id.php
Last active April 27, 2018 05:27
Verify whether a YouTube video exists using PHP and oEmbed status codes. Instead of actually fetching the video’s URL using a tool suchas a cURL, we can speed things up by just checking the response headers by using PHP’s get_headers() function. Full article: https://imelgrat.me/json-xml/oembed-protocol-embed-videos-news/
<?php
/**
* @author Ivan Melgrati
* @copyright 2018
*/
function YouTube_Check_ID($videoID)
{
$is_valid = true;
@ritikm
ritikm / 1_settings.js
Created October 15, 2013 22:57
Pure-JS method of importing settings into Meteor.js. This file is put in server/lib.
environment = process.env.NODE_ENV || "development";
var settings = {
development: {
public: {},
private: {}
},
staging: {
public: {},
private: {}
@jaircuevajunior
jaircuevajunior / change_wordpress_domain.md
Last active July 20, 2019 10:43
Change/Migrate wordpress domain in MySQL

Find/Replace within dump method

This is a very simple method, and for me (as a SysAdmin) it's very practical as I usually make things through SSH terminal.

It's important to say that everything (including text inside posts) that matches the find string WILL BE REPLACED!

For me it's never been a problem so far, but one never knows

First we generate the dump itself, for example:

mysqldump -umyuser -pmypass mydatabase > mydumpfile.sql
@Jehu
Jehu / plugin.php
Last active November 29, 2019 09:56
Use Groundhogg contact fields inside WPForms as smart tags
<?php
/**
* Plugin Name: WPForms GH Contact Smart Tag
* Plugin URI:
* Description: Use Groundhogg contact fields inside WPForms with Smart Tags. Se here for more informations about WPFOrms Smart Tags: https://wpforms.com/docs/how-to-use-smart-tags-in-wpforms/
* Version: 1.0
* Author: Marco Michely
* Author URI: https://www.michely-web-engineering.de
*/
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
@dperetti
dperetti / call_modal_client.js
Last active February 27, 2020 05:54
Meteor Handlebars modal pattern
Session.set('modalData', {template: "modal-backups", title: "Backup", files: [{name: "blah", date: new Date()}]});
$('#myModal').modal();
Date: select first date
StartOfDateWeek: fromTimestamp(timestamp(prop("Date")) - (((day(prop("Date")) == 0) ? 7 : ((day(prop("Date")) - 1) * 24 + toNumber(formatDate(prop("Date"), "H")))) * 60 + toNumber(formatDate(prop("Date"), "m"))) * 60 * 1000)
WeeksFromOriginal: ceil(dateBetween(now(), prop("Date"), "days") / 7)
NearestDate: dateAdd(prop("Date"), prop("WeeksFromOriginal"), "weeks")
Whenever it's 24 hours from last event, NearestDate should update to same + 7 days.
@pascalduez
pascalduez / demo.module
Created December 24, 2011 15:02
Drupal 7 — Basic Ajax form submit (Ajax framework)
<?php
/**
* @file
* Demo module, Basic Ajax form submit (Ajax framework).
*/
/**
* Implements hook_menu().
*/
@Spellhammer
Spellhammer / urlparamexistscondition
Last active August 15, 2022 10:30
Check for presence of URL parameter condition for Oxygen
if( function_exists('oxygen_vsb_register_condition') ) {
global $oxy_condition_operators;
// Condition to check if a URL parameter is present.
oxygen_vsb_register_condition('URL Param Exists', array('options'=>array(), 'custom'=>true), array('--'), 'oxy_url_param_exists_callback', 'Other');
function oxy_url_param_exists_callback($value, $operator) {
if( isset($_GET[$value]) && $_GET[$value] ) {
@JohnBunka
JohnBunka / embed-pdf-google-viewer.php
Created August 16, 2013 21:10
Embed PDFs with Google PDF viewer
<iframe src="http://docs.google.com/gview?url=http://example.com/mypdf.pdf&embedded=true" style="width:100%; height:1000px;" frameborder="0"></iframe>