Skip to content

Instantly share code, notes, and snippets.

@maztch
maztch / read-more
Last active August 29, 2015 14:22
angular read-more directive
//this directive uses jquery...
angular.module('client').directive('readMore', function() {
return {
restrict: 'A',
transclude: true,
replace: true,
template: '<p></p>',
scope: {
moreText: '@',
lessText: '@',
@maztch
maztch / full-width
Last active August 29, 2015 14:25
angular full window width directive
'use strict';
//http://jsfiddle.net/maztch/efccbja5/7/
angular.module('app')
.directive('full', function($window) {
return({
restrict: 'A',
link: function ( $scope, element, attributes ) {
@maztch
maztch / delete_by_prefix.sql
Last active August 29, 2015 14:25
mysql delete tables by prefix
SELECT CONCAT( 'DROP TABLE ', GROUP_CONCAT(table_name) , ';' )
AS statement FROM information_schema.tables
WHERE table_name LIKE 'prefix_%';
@maztch
maztch / .htaccess
Created August 18, 2015 18:10
htaccess for angular html5
Options +FollowSymLinks
<ifModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !index
RewriteRule (.*) index.html [L]
</ifModule>
@maztch
maztch / emmets
Created August 10, 2015 09:45
some emmet
//just some emmet lines to test it
//ul sample
ul>li{Item $}*4
//page header sample
#page>div.logo+ul#navigation>li*5>a{Item $}
//navbar sample
.navbar>ul>li*4>a[href=#]{link $}
@maztch
maztch / remove_dockers.sh
Last active December 10, 2015 18:35
Docker: Remove all images and containers
#!/bin/bash
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
@maztch
maztch / reaplace space file names
Created March 14, 2016 18:55
Replace spaces for undescore in file names
$ for f in *\ *; do mv "$f" "${f// /_}"; done
@maztch
maztch / sublime-alias.md
Created June 8, 2016 14:32
call sublime from console

Make an alias to sublime bin subl. Edit file

~/.bash_profile

add

alias sublime="'/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl'"

restart bash if needed

@maztch
maztch / git-promt
Last active June 10, 2016 21:10
git branch in promt
# Git branch in prompt.
# from http://mfitzp.io/article/add-git-branch-name-to-terminal-prompt-mac/
# add to ~/.bash_profile
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \W\[\033[32m\]\$(parse_git_branch)\[\033[00m\] $ "
@maztch
maztch / sage-gulpfile.js
Last active July 1, 2016 18:29
Gulpfile and sitemap for UnCSS + Gulp + Sage
// ## Globals
var argv = require('minimist')(process.argv.slice(2));
var autoprefixer = require('gulp-autoprefixer');
var browserSync = require('browser-sync').create();
var changed = require('gulp-changed');
var concat = require('gulp-concat');
var flatten = require('gulp-flatten');
var gulp = require('gulp');
var gulpif = require('gulp-if');
var imagemin = require('gulp-imagemin');