Generic commands
find -name skype
whereis drush
sh file.sh //(installing .sh files)
cat file.txt //(open file)
touch file.txt //(creates an empty file)
makedir -p abc/def/ghi //(will make all folders)
less etc/file.txt
echo $PATH
Generic commands
find -name skype
whereis drush
sh file.sh //(installing .sh files)
cat file.txt //(open file)
touch file.txt //(creates an empty file)
makedir -p abc/def/ghi //(will make all folders)
less etc/file.txt
echo $PATH
git log -n 2 | |
git log --since=2012-06-15 | |
git log --until=2012-06-15 | |
git log --author="Nadeem" | |
git log --oneline | |
git log SHA1..SHA2 --oneline | |
git log SHA..index.html | |
git log --format=short | |
git show SHA | |
git show --format=online HEAD |
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:
/** | |
* Custom myCRED Widget: This months leaderboard | |
* This widget will show this months leaderbaord with the option to set | |
* a title, the number of users to include and if it should be visible for | |
* non-members. | |
* @install Paste into your theme or child-themes functions.php file | |
* @author Gabriel S Merovingi | |
* @version 1.0 | |
*/ |
Change WordPress user role based on Mycred Points:
add_filter( 'mycred_add', 'check_for_role_change', 99, 3 );
function check_for_role_change( $reply, $request, $mycred ) {
// Make sure that if any other filter has declined this we also decline
if ( $reply === false ) return $reply;
// Exclude admins
if ( user_can( $request['user_id'], 'manage_options' ) ) return $reply;
Create Custom Fields in Woocommerce Checkout Page and Display them in Orders Details Page in Admin Area with this WordPress plugin:
<?php
/**
* Plugin Name: Flowershop - WooCommerceCustomOverrides
* Plugin URI: http://chillopedia.com
* Description: Overrides WooCommerce Checkout Form Fields
Add the field to order emails:
add_filter('woocommerce_email_order_meta_keys', 'my_woocommerce_email_order_meta_keys');
function my_woocommerce_email_order_meta_keys( $keys ) {
$keys['How did you hear about us?'] = 'hear_about_us';
return $keys;
}
I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.
If you want to roll up all of these into a single jQuery plugin check out Sharrre
Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.
This extends the built-in WordPress function get_the_ID()
to return the post ID both inside and outside the loop.
<?php if ( function_exists( 'gt_hide_nav' ) && ! gt_hide_nav() ) : ?>
<nav role="navigation">
<?php if ( function_exists( 'bones_main_nav' ) ) bones_main_nav(); ?>
</nav>
csvmain = CSV.read('data-cleaned.csv', headers:true);nil
csvsku = CSV.read('spree_products_sku.csv', headers:true)
new_rows = [csvmain.headers]
index = 0
index_parsed = 0
start_index = 0
indices = []
csvsku.each do |row|
not_found = true
index = start_index