/root/mongo_bkp.sh
rm -rf /root/dump* && mongodump && tar -cvf dump.tar dump/
ssh user@machine /root/mongo_bkp.sh
# prints quote of the day | |
$temp = [System.IO.Path]::GetTempPath() | |
$today = Get-Date -UFormat "%Y-%m-%d" | |
$file = "$temp\qod-$today.json" | |
try { | |
if (Test-Path $file) { | |
$qod = (Get-Content -Path $file | ConvertFrom-Json) | |
} else { |
<?php | |
/* | |
Plugin Name: Import demo | |
Plugin URI: http://royduineveld.nl | |
Description: A demo import for my blog | |
Version: 1.0 | |
Author: Roy Duineveld | |
Author URI: http://royduineveld.nl | |
*/ |
db.collection.find().limit(1).skip(_rand()*db.collection.count()); |
<?php | |
/** | |
* Use * for origin | |
*/ | |
add_action( 'rest_api_init', function() { | |
remove_filter( 'rest_pre_serve_request', 'rest_send_cors_headers' ); | |
add_filter( 'rest_pre_serve_request', function( $value ) { | |
header( 'Access-Control-Allow-Origin: *' ); | |
header( 'Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE' ); |
<?php | |
add_filter( 'user_contactmethods', 'add_new_user_fields' ); | |
function add_new_user_fields( $user_contact ) { | |
$user_contact[ 'billing_cel_phone' ] = 'Celular'; | |
return $user_contact; | |
} |
// When using angular-translate it's impossible to make two-way data binding translations yet, | |
// and this sometimes can be a headache. So I've developed this directive to save some time. | |
// The view goes like this: <TAG data-bind-translate="scopeObjToTranslate.item.text"></TAG>. | |
angular.module('myApp', ['pascalprecht.translate']).directive('bindTranslate', [ | |
'$translate', | |
'$parse', | |
function($translate, $parse) { |
.woocommerce.single-product .product .summary .variations { | |
width: 100%; | |
} | |
.woocommerce.single-product .product .summary .variations td { | |
display: block; | |
width: 100%; | |
} | |
.woocommerce.single-product .product .summary .variations td label { | |
font-family: 'Nunito', Helvetica, Arial, sans-serif; | |
letter-spacing: 0px; |
/** | |
* Find the distance between two points | |
* @param {Object} pointA {lat,lng} | |
* @param {Object} pointB {lat,lng} | |
* @return {Float} Distance | |
*/ | |
function howFar(pointA, pointB) { | |
var R,Dlat,Dlong,a,b,c,d; | |
var rad = function(x) {return x*Math.PI/180;} |