Skip to content

Instantly share code, notes, and snippets.

<?php
$start_dir = 'whatever'; // Starting directory name no trailing slashes.
$perms['file'] = 0644; // chmod value for files don't enclose value in quotes.
$perms['folder'] = 0755; // chmod value for folders don't enclose value in quotes.
function chmod_file_folder($dir) {
global $perms;
$dh=@opendir($dir);
@cmpscabral
cmpscabral / gist:65b0bd6428c2e2b11a18096a9631375f
Created April 6, 2016 16:23
redirect .dev domains to virtual machine
# Install dnsmasq
$ brew install dnsmasq
# Copy the default configuration file.
$ cp $(brew list dnsmasq | grep /dnsmasq.conf.example$) /usr/local/etc/dnsmasq.conf
# Copy the daemon configuration file into place.
$ sudo cp $(brew list dnsmasq | grep /homebrew.mxcl.dnsmasq.plist$) /Library/LaunchDaemons/
# Start Dnsmasq automatically.
@cmpscabral
cmpscabral / _mixins.scss
Created April 14, 2016 09:57
media queries for retina displays
/* @2x Images (Pixel Ratio of 1.25+) */
@mixin image-2x($image, $width, $height) {
@media only screen and (min--moz-device-pixel-ratio: 5/4),
only screen and (-o-min-device-pixel-ratio: 5/4),
only screen and (-webkit-min-device-pixel-ratio: 1.25),
only screen and (min-device-pixel-ratio: 1.25),
only screen and (min-resolution: 1.25dppx) {
background-image: url($image);
background-size: $width $height;
}
@cmpscabral
cmpscabral / mysqltop.sh
Last active April 18, 2016 22:48
Poor Man's "Top" for MySQL
#
# http://naleid.com/blog/2009/06/18/poor-mans-top-for-mysql
#
watch -n 5 --differences "mysql -u root -p -e 'show processlist'"
<?php
/*
// recipients array example
$recipients = array(
array('address'=>
array(
'email' => '[email protected]',
'name'=>'Carlos Cabral'
)
@cmpscabral
cmpscabral / browser-sync.sh
Created July 8, 2016 23:33
start browser sync proxy
browser-sync start --proxy "ds.dev" --files "dist/css/*.css" --host 192.168.200.2
diff <(sort -u <(dig +nottlid +noall +answer @ns.myfirstserver.com example.com ANY) ) <(sort -u <(dig +nottlid +noall +answer @ns.mysecondserver.com example.com ANY) )
@mixin valid-quantity($quantity) {
@if type-of($quantity) != 'number' {
@error 'The "quantity" parameter must be a number!';
}
@if not(unitless($quantity)) {
@error 'The "quantity" parameter must not have a unit!';
}
@if $quantity < 0 {
@error 'The "quantity" parameter must be at least 0!';
}
KEYBINDINGS
byobu keybindings can be user defined in /usr/share/byobu/keybindings/ (or within .screenrc if byobu-export was used). The common key bindings
are:
F2 - Create a new window
F3 - Move to previous window
F4 - Move to next window
@cmpscabral
cmpscabral / instal.sh
Created April 13, 2018 15:18
install docker mysql
curl -sSL https://get.docker.com/ | sh
sudo docker run --name mysql-57-container -p 127.0.0.1:3310:3306 -e MYSQL_ROOT_PASSWORD=rootpassword -d mysql:5.7
mysql -u root -p --host=127.0.0.1 --port=3310