Skip to content

Instantly share code, notes, and snippets.

View nandomoreirame's full-sized avatar
🎧
Working from home

Fernando Moreira nandomoreirame

🎧
Working from home
View GitHub Profile
@obliviusm
obliviusm / commands.md
Last active October 29, 2020 08:28
Commands
Rake
  1. rake -T -A Run from your Rails home directory to see all the tasks that rake knows about. Yours must be in that list for rake to run it.
  2. http://stackoverflow.com/questions/12409544/how-to-disable-rack-mini-profiler-temporarily
  3. run rails in production mode lacaly: bundle exec rake assets:clean && bundle exec rake assets:precompile && bundle exec rails s -e production_local
  4. bundle exec rake konacha:serve
  5. rake time:zones:all - all available time zones
Git
  1. Reset all changes after last commit in git First reset the changes git reset HEAD --hard then clean out everything untracked git clean -fd
  2. Removing multiple files from a Git repo that have already been deleted from disk git ls-files --deleted -z | xargs -0 git rm
@celsofabri
celsofabri / find-replace-sql-wp.sql
Created November 20, 2014 21:06
SQL Query para fazer um simples localizar e substituir / SQL Query to do a simple find and replace
UPDATE wp_posts SET guid = replace(guid, 'http://olddomain.com','http://newdomain.com');
UPDATE wp_posts SET post_content = replace(post_content, 'http://olddomain.com', 'http://newdomain.com');
UPDATE wp_links SET link_url = replace(link_url, 'http://olddomain.com', 'http://newdomain.com');
UPDATE wp_links SET link_image = replace(link_image, 'http://olddomain.com', 'http://newdomain.com');
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://olddomain.com', 'http://newdomain.com');
UPDATE wp_usermeta SET meta_value = replace(meta_value, 'http://olddomain.com', 'http://newdomain.com');
/*UPDATE wp_options SET option_value = replace(option_value, 'http://olddomain.com', 'http://newdomain.com') WHERE option_name = 'home' OR option_name = 'siteurl' OR option_name = 'widget_text' OR option_name = 'dashboard_widget_options';*/
UPDATE wp_options SET option_value = replace(option_value, 'http://olddomain.com', 'http://newdomain.com');
@nadeem-khan
nadeem-khan / Rails-Commands.md
Last active November 6, 2017 12:48
Rails Commands

New Rails Project:

 rails new blog

Run Rails Console:

RAILS_ENV=production rails c  (restart console too whenever you make a change in the model)

View All Routes:

@bhwebworks
bhwebworks / Add custom metaboxes to WooCommerce products
Last active May 8, 2023 10:50
Add custom metaboxes to WooCommerce products
/**
* Create Custom Meta Boxes for WooCommerce Product CPT
*
* Using Custom Metaboxes and Fields for WordPress library from
* Andrew Norcross, Jared Atchinson, and Bill Erickson
*
* @link http://blackhillswebworks.com/?p=5453
* @link https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress
*/
@danasilver
danasilver / README.md
Last active November 6, 2017 12:48
Jekyll Pygments/Redcarpet Global Configs

Jekyll Pygments/Redcarpet Global Configs

A Jekyll plugin that enables global configuration options for Pygments.

  • Add pygments_global_config.rb to my-jekyll-project/_plugins/.

  • Add Pygments options to _config.yml

markdown: redcarpet
@yamayo
yamayo / Gemfile
Last active January 10, 2019 19:29
AWS S3 upload/download with gzip
# A sample Gemfile
source 'https://rubygems.org'
gem 'aws-sdk'
gem 'pit'
@fdaciuk
fdaciuk / functions.php
Created July 28, 2013 19:43
Adicionar metaboxes a pages específicas no WP
<?php
/*
Adicionar metabox à páginas específicas
*/
function my_meta_setup_1() {
// criação da metabox
}
function especific_metabox_pages() {
$post_ID = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'];
@unfulvio
unfulvio / functions.php
Last active July 15, 2021 05:17
WordPress HTML Minification Class to compress HTML (removal of whitespaces, line breaks, new lines, comments). Preserves script comments (if removed might break some javascripts like Google Analytics or Adsense) and IE specific tags.
/* Minifies HTML and removes comments (except IE tags and comments within script tags)
*
* To disable compression of code portions, use '<!--wp-html-compression no compression-->' tag
*
* @see http://forrst.com/posts/Wordpress_Minify_output_HTML-29q
* @see http://www.intert3chmedia.net/2011/12/minify-html-javascript-css-without.html
*/
class WP_HTML_Compression
{
// Settings
@claudiosanches
claudiosanches / theme-options-functions.php
Created December 1, 2012 21:16
WordPress - Theme Settings Framework
<?php
// Esse é o arquivo com a base das funções.
// Tente não alterar ele.
/**
* Theme Options Functions
*/
/**
* Load options scripts
@fat
fat / gist:3744369
Created September 18, 2012 17:10
all you probably really need
/*! normalize-all-you-really-need-tho.css v1.0.0 | MIT License */
html {
font-family: sans-serif; /* 1 */
-webkit-text-size-adjust: 100%; /* 2 */
-ms-text-size-adjust: 100%; /* 2 */
}
body {
margin: 0;