Skip to content

Instantly share code, notes, and snippets.

@dm7
dm7 / .gitignore
Created March 9, 2016 07:59 — forked from salcode/.gitignore
.gitignore file for WordPress - Bare Minimum Git
# -----------------------------------------------------------------
# .gitignore for WordPress
# Bare Minimum Git
# http://ironco.de/bare-minimum-git/
# ver 20150227
#
# This file is tailored for a WordPress project
# using the default directory structure
#
# This file specifies intentionally untracked files to ignore
@dm7
dm7 / node-and-npm-in-30-seconds.sh
Created September 1, 2016 16:41 — forked from isaacs/node-and-npm-in-30-seconds.sh
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@dm7
dm7 / MySQL Replication Check
Created September 6, 2016 07:05 — forked from ssimpson89/MySQL Replication Check
Just a simple Mysql Replication Health Check script I wrote. You can put this in a cron.
#!/bin/bash
### VARIABLES ### \
EMAIL=""
SERVER=$(hostname)
MYSQL_CHECK=$(mysql -e "SHOW VARIABLES LIKE '%version%';" || echo 1)
LAST_ERRNO=$(/usr/bin/mysql -e "SHOW SLAVE STATUS\G" | grep "Last_Errno" | awk '{ print $2 }')
SECONDS_BEHIND_MASTER=$(/usr/bin/mysql -e "SHOW SLAVE STATUS\G"| grep "Seconds_Behind_Master" | awk '{ print $2 }')
IO_IS_RUNNING=$(/usr/bin/mysql -e "SHOW SLAVE STATUS\G" | grep "Slave_IO_Running" | awk '{ print $2 }')
SQL_IS_RUNNING=$(/usr/bin/mysql -e "SHOW SLAVE STATUS\G" | grep "Slave_SQL_Running" | awk '{ print $2 }')
// Node.js CheatSheet.
// Download the Node.js source code or a pre-built installer for your platform, and start developing today.
// Download: http://nodejs.org/download/
// More: http://nodejs.org/api/all.html
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html
// Node.js CheatSheet.
// Download the Node.js source code or a pre-built installer for your platform, and start developing today.
// Download: http://nodejs.org/download/
// More: http://nodejs.org/api/all.html
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html
@dm7
dm7 / angular_cheatsheet.js
Created June 17, 2017 10:06
Angular 1 CheatSheet
// Angular 1 - CheatSheet.
// Directives: HTML annotations that trigger JavaScript behaviors.
// Modules: Where our application components live.
// Controllers: Where we add application bahavior.
// Expressions: How values get displayed within the page.
@dm7
dm7 / angular_cheatsheet.js
Created June 17, 2017 10:06
Angular 1 CheatSheet
// Angular 1 - CheatSheet.
// Directives: HTML annotations that trigger JavaScript behaviors.
// Modules: Where our application components live.
// Controllers: Where we add application bahavior.
// Expressions: How values get displayed within the page.
@dm7
dm7 / redis_cheatsheet.bash
Created June 17, 2017 10:07 — forked from LeCoupa/redis_cheatsheet.bash
Redis Cheatsheet - Basic Commands You Must Know
# Redis Cheatsheet
# All the commands you need to know
redis-server /path/redis.conf # start redis with the related configuration file
redis-cli # opens a redis prompt
# Strings.
@dm7
dm7 / objective-c-cheatsheet.m
Created June 17, 2017 10:07
Objective C CheatSheet
NSString *firstName = @"Julien";
NSNumber *age = @11;
NSArray *apps = @[@"AngryFowl", @"Lettertouch", @"Tweetrobot"];
NSDictionary *person = @{@"First Name": @"Eric", @"Last Name": @"Schmidt"};
NSLog(@"Here is how you display something on screen");
NSLog(@"%@ is %@ years old and he is playing %@", firstName, age, apps[1]);
NSLog(@"Here is my first name %@.", person[@"First Name"]);
@dm7
dm7 / optimizely-js-api-cheatsheet.js
Created June 17, 2017 10:07 — forked from LeCoupa/optimizely-js-api-cheatsheet.js
Optimizely Javascript API Cheatsheet
// Optimizely JavaScript API
// http://developers.optimizely.com/javascript/
// To opt a visitor out of Optimizely tracking
// http://www.example.com/page.html?optimizely_opt_out=true
// 1. API Function Calls
// http://developers.optimizely.com/javascript/#api-function-calls-2