Skip to content

Instantly share code, notes, and snippets.

View marcanuy's full-sized avatar
💭
⌨ on 🔥

marcanuy

💭
⌨ on 🔥
View GitHub Profile
@marcanuy
marcanuy / strip_tags_content.php
Created November 26, 2013 00:18
A function that removes the HTML tags along with their contents.
<?php
/*
* This code belongs to a comment found in http://php.net/manual/en/function.strip-tags.php
* by mariusz.tarnaski at wp dot pl
**/
function strip_tags_content($text, $tags = '', $invert = FALSE) {
preg_match_all('/<(.+?)[\s]*\/?[\s]*>/si', trim($tags), $tags);
$tags = array_unique($tags[1]);
@marcanuy
marcanuy / commands
Created November 20, 2013 01:25
Useful shell command
#List user processes with their memory usage and total usage.
ps -u marcanuy -o pid,rss,command | awk '{print $0}{sum+=$2} END {print "Total", sum/1024, "MB"}'
#find all file larger than 500M in home dir
find ~ -type f -size +500M -exec ls -ls {} \; | sort -n
source 'https://rubygems.org'
ruby '2.0.0'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'
# Use sqlite3 as the database for Active Record
group :development do
gem 'sqlite3'
end
@marcanuy
marcanuy / MYDB.cnf
Last active December 6, 2021 04:57
Database maintenance from console.
[client]
host=
user=
password=