One Paragraph of project description goes here
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
| /** | |
| * Mass (bulk) insert or update on duplicate for Laravel 4/5 | |
| * | |
| * insertOrUpdate([ | |
| * ['id'=>1,'value'=>10], | |
| * ['id'=>2,'value'=>60] | |
| * ]); | |
| * | |
| * | |
| * @param array $rows |
| #!/bin/sh | |
| # Config for SSL. | |
| echo "--- Making SSL Directory ---" | |
| mkdir /etc/nginx/ssl | |
| echo "--- Copying $i SSL crt and key ---" | |
| openssl req -nodes -new -x509 -keyout /etc/nginx/ssl/server.key -out /etc/nginx/ssl/server.crt -subj "/C=US/ST=NY/L=NYC/O=Dis/CN=www.example.com" | |
| echo "--- Turning SSL on in nginx.conf. ---" |
TCL-Expect scripts are an amazingly easy way to script out laborious tasks in the shell when you need to be interactive with the console. Think of them as a "macro" or way to programmaticly step through a process you would run by hand. They are similar to shell scripts but utilize the .tcl extension and a different #! call.
The first step, similar to writing a bash script, is to tell the script what it's executing under. For expect we use the following:
#!/usr/bin/expect
| #DROPBOX SYNCING | |
| #============== | |
| # bash_profile | |
| rm -rf .bash_profile | |
| ln -s ~/Dropbox/.bash_profile .bash_profile | |
| # Sublime 2 Preferences | |
| cd ~/Library/Application\ Support/Sublime\ Text\ 2/ | |
| ln -s ~/Dropbox/appdata/sublime/Installed\ Packages ./Installed\ Packages |
| #Recommended minimum configuration: | |
| acl manager proto cache_object | |
| acl localhost src 127.0.0.1/32 | |
| acl to_localhost dst 127.0.0.0/8 | |
| acl localnet src 0.0.0.0/8 192.168.100.0/24 192.168.101.0/24 | |
| acl SSL_ports port 443 | |
| acl Safe_ports port 80 # http | |
| acl Safe_ports port 21 # ftp | |
| acl Safe_ports port 443 # https | |
| acl Safe_ports port 70 # gopher |
| #!/bin/bash | |
| for file in `find .` | |
| do | |
| EXTENSION="${file##*.}" | |
| if [ "$EXTENSION" == "php" ] || [ "$EXTENSION" == "phtml" ] | |
| then | |
| RESULTS=`php -l $file` |
| <?php | |
| $tables = Yii::app()->db->schema->getTableNames(); | |
| foreach ($tables as $table) { | |
| Yii::app()->db->createCommand()->dropTable($table); | |
| } |
| // example function where arguments 2 and 3 are optional | |
| function example( err, optionalA, optionalB, callback ) { | |
| // retrieve arguments as array | |
| var args = []; | |
| for (var i = 0; i < arguments.length; i++) { | |
| args.push(arguments[i]); | |
| } | |
| // first argument is the error object |
Welcome!
UPDATE: This list is no longer maintained. I've moved it to its own repo so you can send suggestions as Pull Requests. https://github.com/dideler/bootstrapping/
For feedback or suggestions, please send a tweet (@dideler). Gist comments don't notify me. Pull requests aren't possible with gists (yet), so I don't recommend forking because then I can't easily get the change.
Starring this gist will give me an idea of how many people consider this list useful.