Skip to content

Instantly share code, notes, and snippets.

View romuloctba's full-sized avatar
:octocat:

RcDev romuloctba

:octocat:
View GitHub Profile
@andregs
andregs / profile.ps1
Last active March 2, 2019 11:28
PowerShell script to set the user profile with quote of the day, custom prompt string, and CTRL+D shortcut to close the window
# 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
*/
@cristopher-rodrigues
cristopher-rodrigues / randdata.js
Created December 2, 2015 16:30
mongo random find data
db.collection.find().limit(1).skip(_rand()*db.collection.count());
@cristopher-rodrigues
cristopher-rodrigues / mongo_bkp.markdown
Last active December 2, 2015 13:09
Mongo copy last data (SIMPLE BKP)

Create script on server

/root/mongo_bkp.sh

rm -rf /root/dump* && mongodump && tar -cvf dump.tar dump/

Exec script

ssh user@machine /root/mongo_bkp.sh
<?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' );
@fdaciuk
fdaciuk / functions.php
Last active April 12, 2016 20:30
Adicionar mais campos no perfil de usuário do WordPress
<?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;
}

Hexo with Google search bar

// 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) {
@codescribblr
codescribblr / custom-variations-select.css
Last active January 5, 2023 20:10
Custom Select Box Replacements for Woocommerce Variations
.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;
@dhoko
dhoko / distance.js
Last active December 3, 2015 23:48
Calculer la distance en km entre deux points
/**
* 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;}