Skip to content

Instantly share code, notes, and snippets.

View calvimor's full-sized avatar

Carlos Alberto Villamizar Morantes calvimor

View GitHub Profile
@calvimor
calvimor / wordpress-change-domain-migration.sql
Created September 8, 2017 13:08 — forked from chuckreynolds/wordpress-change-domain-migration.sql
Use this SQL script when changing domains on a WordPress site. Whether you’re moving from an old domain to a new domain or you’re changing from a development domain to a production domain this will work. __STEP1: always backup your database. __STEP2: change the ‘oldsite.com’ and ‘newsite.com’ variables to your own. __STEP3: make sure your databa…
SET @oldsite='http://oldsite.com';
SET @newsite='http://newsite.com';
UPDATE wp_options SET option_value = replace(option_value, @oldsite, @newsite) WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET post_content = replace(post_content, @oldsite, @newsite);
UPDATE wp_links SET link_url = replace(link_url, @oldsite, @newsite);
UPDATE wp_postmeta SET meta_value = replace(meta_value, @oldsite, @newsite);
/* only uncomment next line if you want all your current posts to post to RSS again as new */
#UPDATE wp_posts SET guid = replace(guid, @oldsite, @newsite);
@calvimor
calvimor / wp-install.sh
Created March 9, 2017 18:47 — forked from cballou/wp-install.sh
Handle a near auto-installation of Wordpress on Ubuntu 14.04.
#!/bin/bash
# MySQL database defaults
dbname="wordpress"
dbuser="wordpress"
# Gather user info
read -r -p "Enter your domain, e.g. mywebsite.co (no http://, no www.): " wpURL
read -r -p "Enter a secure MySQL root password to use (save this somewhere): " rootpass
read -r -p "Enter a secure MySQL WordPress password to use: " userpass
<html>
<head>
<title>API Example</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
var accessToken = "<your agent's client access token>";
var baseUrl = "https://api.api.ai/v1/";
$(document).ready(function() {
$("#input").keypress(function(event) {
@calvimor
calvimor / WSSoapClient.php
Created September 12, 2016 21:05 — forked from johnkary/WSSoapClient.php
WS-Security for PHP SoapClient
<?php
/**
* Copyright (c) 2007, Roger Veciana
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
@calvimor
calvimor / .babelrc
Created June 13, 2016 13:16 — forked from bdchauvette/.babelrc
Minimal babel boilerplate
{
"presets": [ "es2015" ]
}
@calvimor
calvimor / async.cs
Created June 8, 2016 21:54 — forked from dgrunwald/async.cs
Async/Await support for .NET 4.0
// Copyright (c) 2012 Daniel Grunwald
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
@calvimor
calvimor / slim-redux.js
Created March 15, 2016 16:31 — forked from gaearon/slim-redux.js
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {
@calvimor
calvimor / pecl-memcached.sh
Last active March 2, 2016 20:37 — forked from paul91/pecl-memcached.sh
How to install php memcached on CentOS 6.5
#!/bin/bash
# How to install PHP memcached on CentOS 6.5
# Install dependencies
yum install cyrus-sasl-devel zlib-devel gcc-c++
# Get the latest libmemcached
wget https://launchpad.net/libmemcached/1.0/1.0.16/+download/libmemcached-1.0.16.tar.gz
tar -xvf libmemcached-1.0.16.tar.gz