Skip to content

Instantly share code, notes, and snippets.

View iamtekeste's full-sized avatar
🕺
having fun with code

Tekeste Gebreanenia iamtekeste

🕺
having fun with code
View GitHub Profile
@iamtekeste
iamtekeste / drupal-views-share-global-text-field
Last active August 29, 2015 14:26 — forked from chrisjlee/drupal-views-share-global-text-field
share url's for facebook, twitter, pinterest with just get variables
<ul>
<li class="share-text">Share this>/li>
<li class="share-tw"><a href="http://twitter.com/share?text=[title]"><span></span></a></li>
<li class="share-fb"><a href="http://www.facebook.com/sharer.php?u=/node/[nid]&p=[title]"><span></span></a></li>
<li class="share-pinterest"><a href="http://pinterest.com/pin/create/button/?url=/node/[nid]&description=[title]"><span></span></a></li>
</ul>
@iamtekeste
iamtekeste / 7zip commands.sh
Created July 25, 2015 17:33
7zip commands
1. Create an archive
7z a zipname.7z dirname
2. Extract an arichive
7z e basic.7z
3. List archive details
7z l basic.7z
4. Update an existing archive
7z u basic.7z basic
Source: https://www.ibm.com/developerworks/community/blogs/6e6f6d1b-95c3-46df-8a26-b7efd8ee4b57/entry/how_to_use_7zip_on_linux_command_line144?lang=en
@iamtekeste
iamtekeste / list folders.sh
Last active August 29, 2015 14:24
List Folders inside a folder and show their size in human readable format
du -h --max-depth=1
@iamtekeste
iamtekeste / Download Google Drive files with WGET
Created July 8, 2015 11:00
Download Google Drive files with WGET
Download Google Drive files with WGET
Example Google Drive download link:
https://docs.google.com/open?id=[ID]
To download the file with WGET you need to use this link:
https://googledrive.com/host/[ID]
Example WGET command:
<a class="cart-contents" href="<?php echo WC()->cart->get_cart_url(); ?>" title="<?php _e( 'View your shopping cart' ); ?>"><?php echo sprintf (_n( '%d item', '%d items', WC()->cart->cart_contents_count ), WC()->cart->cart_contents_count ); ?> - <?php echo WC()->cart->get_cart_total(); ?></a>
@iamtekeste
iamtekeste / swap the keybindings for paste and paste_and_indent
Created June 22, 2015 12:33 — forked from twosixcode/gist:1988097
swap the keybindings for paste and paste_and_indent
// swap the keybindings for paste and paste_and_indent
{ "keys": ["super+v"], "command": "paste_and_indent" },
{ "keys": ["super+shift+v"], "command": "paste" }
@iamtekeste
iamtekeste / directory file size
Created May 23, 2015 14:59
List the content of a directory with thier size
du -h --max-depth=1 /var/www | sort -nk1
@iamtekeste
iamtekeste / terms with apersands
Created May 19, 2015 06:51
If your term name or titles have ampersands then use _wp_specialchars
function get_cat_ID( $cat_name ) {
$cat_name = _wp_specialchars( $cat_name ); // get_term_by expects $cat_name to be escaped
$cat = get_term_by( 'name', $cat_name, 'category' );
}
@iamtekeste
iamtekeste / post meta
Created May 18, 2015 07:54
Use value of post meta for something when the post meta changes
/**
* Use value of post meta for something when the post
* meta changes
* @param integer $meta_id ID of the meta data field
* @param integer $post_id Post ID
* @param string $meta_key Name of meta field
* @param string $meta_value Value of meta field
*/
function saveYouTubeInfo($meta_id, $post_id, $meta_key='',
$meta_value=''){
@iamtekeste
iamtekeste / Bootstrap modal centering
Created March 10, 2015 11:57
Vertically Centering Bootstrap Modals
// from http://www.abeautifulsite.net/vertically-centering-bootstrap-modals/
/**
* Vertically center Bootstrap 3 modals so they aren't always stuck at the top
*/
$(function() {
function reposition() {
var modal = $(this),
dialog = modal.find('.modal-dialog');
modal.css('display', 'block');