Skip to content

Instantly share code, notes, and snippets.

@code26
code26 / gist:2d1c7b4527b02f2c5c9e398da9eced6f
Created Jun 19, 2018
Bash: Search for 'keyword' in files
View gist:2d1c7b4527b02f2c5c9e398da9eced6f
grep -rnw '/path/to/somewhere/' -e 'pattern'
View backup_restore_tar_centos.txt
#BACKUP
tar zcvf - --exclude=/proc --exclude=/sys --exclude=/dev / | ssh myuser@backupmachine_ip_addr "cat > /home/myuser/VPSbackup.tar.gz"
#RESTORE
cd /
ssh myuser@backupmachine_ip_addr "cat /home/myuser/VPSbackup.tar.gz" | tar zxvf -
View README.md

Font Face

A mixin for writing @font-face rules in SASS.

Usage

Create a font face rule. Embedded OpenType, WOFF2, WOFF, TrueType, and SVG files are automatically sourced.

@include font-face(Samplino, fonts/Samplino);
@code26
code26 / wp-get_id_by_slug
Created Mar 17, 2016 — forked from eddt/wp-get_id_by_slug
WordPress: Get page ID from slug
View wp-get_id_by_slug
// Usage:
// get_id_by_slug('any-page-slug','any-post-type');
function get_id_by_slug($page_slug, $slug_page_type = 'page') {
$find_page = get_page_by_path($page_slug, OBJECT, $slug_page_type);
if ($find_page) {
return $find_page->ID;
} else {
return null;
}
View mailchimp-form
<form id="voucherForm" class="form-horizontal subscription-form" action="//joomajam.us3.list-manage.com/subscribe/post-json?u=f64550e28767fd3a1b65f5557&id=fb450161c3&c=?" method="post">
<div class="form-group">
<label for="mce-EMAIL" class="control-label label-email">Enter your Mom’s or Dad’s e-mail</label>
<div class="">
<input type="email" class="form-control" id="mce-EMAIL" name="EMAIL">
</div>
</div>
<div class="row">
<div class="col-sm-8">
<figure class="btn-container full pull-right">
View mailchimp
var app = (function(){
return {
events: function() {
//form
var $form = $('#subscribeForm'),
$formContainer = $('.form-container'),
$notify = $('.error-msg',$formContainer);
if ( $form.length > 0 ) {
$form.on('submit',function(e){
@code26
code26 / transpose.js
Created Feb 1, 2016
simple transpose
View transpose.js
//from http://stackoverflow.com/a/7936999
function transposeChord(chord, amount) {
var scale = ["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"];
return chord.replace(/[CDEFGAB]#?/g,
function(match) {
var i = (scale.indexOf(match) + amount) % scale.length;
return scale[ i < 0 ? i + scale.length : i ];
});
}
@code26
code26 / gist:149e98ee20d1b68164bf
Created Jan 8, 2016
Grant permission to user
View gist:149e98ee20d1b68164bf
sudo usermod -aG www-data username
sudo chown -R www-data:www-data /var/www/example.com/public_html
sudo chmod -R 770 /var/www/example.com/public_html
View sublime.settings.json
{
"auto_complete": false,
"auto_complete_commit_on_tab": false,
"bold_folder_labels": true,
"caret_extra_bottom": 0,
"caret_extra_top": 0,
"caret_extra_width": 1,
"caret_style": "phase",
"color_inactive_tabs": true,
"color_scheme": "Packages/Seti_UI/Scheme/Seti_monokai.tmTheme",
@code26
code26 / gulp-watch_ENOSPC_fix.md
Created Jul 23, 2015
fix for the mysterious error on Ubuntu
View gulp-watch_ENOSPC_fix.md

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

OR

npm dedupe