Skip to content

Instantly share code, notes, and snippets.

@spyesx
spyesx / truncate-text.css
Last active August 29, 2015 14:23
Truncate text in CSS to be SEO friendly
.trucate{
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
@spyesx
spyesx / jquery.removeClassRegEx.js
Last active September 16, 2015 20:08
jQuery.removeClassRegEx() remove classes by using a Regex
(function($)
{
$.fn.removeClassRegEx = function(regex)
{
return this.each(function()
{
var classes = $(this).attr('class');
if( !classes || !regex){ return false; }
@spyesx
spyesx / fix_node_sass
Created November 26, 2015 18:18
'libsass bindings not found. Try reinstalling 'node-sass'?
npm uninstall gulp-sass node-sass --save-dev
npm install gulp-sass node-sass --save-dev
@spyesx
spyesx / foundation.row-fullwidth.sass
Created January 1, 2016 17:19
Full width for Zurb Foundation
.row{
&.full-width{
width: 100%;
max-width: 100%!important; //might be needded depending on your settings
&>.column:first-child,
&>.columns:first-child{
padding-left: 0;
}
&>.column:last-child,
&>.columns:last-child{
@spyesx
spyesx / import_sql_from_file
Created February 3, 2016 17:31
Mysql commands to import SQL from a file
cd path/to/the/sql/
mysql -p mysqlUser -p
use dbName
source file.sql
@spyesx
spyesx / no_value_select.html
Created September 1, 2016 12:25
Select empty at the beginning without user to be able to select an empty value after the first change. Good for custom placeholder/label.
<select name="">
<option selected disabled hidden style="display: none;" value=""></option>
<option value="option-1">Option 1</option>
<option value="option-2">Option 2</option>
</select>
@spyesx
spyesx / ncu.sh
Last active September 1, 2016 12:26
node check updates
$ npm install node-check-updates
$ ncu -u
#if it doesn't work
$ ncu -a
@spyesx
spyesx / disable_pingback_ping.php
Created September 2, 2016 09:36
Disable XML RPC Ping back to protect Wordpress from DDOS
<?php
add_filter( 'xmlrpc_methods', function( $methods ) {
unset( $methods['pingback.ping'] );
return $methods;
} );
@spyesx
spyesx / Batch_resize_images.sh
Created April 30, 2017 08:23
Batch resize images
# sips -- scriptable image processing system
# https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/sips.1.html
sips -Z 3400 *.jpg
@spyesx
spyesx / wordpress_migrate_db.php
Last active May 24, 2017 10:03
Create multiple SQL DB for different environments based on a local one. Useful for Wordpress.
<?php
/*
Folder tree :
./wordpress_migrate_db.php
./local
./dev
./preprod
./prod