This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Save this file as gimli/.git/hooks/pre-push and make it executable. | |
protected_branch='master' | |
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,') | |
if [ $protected_branch = $current_branch ] | |
then | |
read -p "GIMLi encourages developers to push only to the 'dev' branch. You're about to push to 'master', is that what you intended? [y|n] " -n 1 -r < /dev/tty | |
echo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* simple method to encrypt or decrypt a plain text string | |
* initialization vector(IV) has to be the same when encrypting and decrypting | |
* | |
* @param string $action: can be 'encrypt' or 'decrypt' | |
* @param string $string: string to encrypt or decrypt | |
* | |
* @return string | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
"United States" => "us", | |
"Afghanistan" => "af", | |
"Albania" => "al", | |
"Algeria" => "dz", | |
"American Samoa" => "as", | |
"Andorra" => "ad", | |
"Angola" => "ad", | |
"Anguilla" => "ai", | |
"Antarctica" => "aq", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* http://stackoverflow.com/questions/11305797/remove-zero-width-space-characters-from-a-javascript-string | |
* U+200B zero width space | |
* U+200C zero width non-joiner Unicode code point | |
* U+200D zero width joiner Unicode code point | |
* U+FEFF zero width no-break space Unicode code point | |
*/ | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package regex; | |
import org.junit.Test; | |
import java.util.HashMap; | |
import java.util.List; | |
import java.util.Map; | |
import static regex.CronRegex.Field.*; | |
import static java.util.Arrays.asList; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# base code found here: http://stackoverflow.com/questions/3085990/post-a-file-string-using-curl-in-php | |
$delimiter = '----WebKitFormBoundary'.uniqid(); | |
$data = create_post($delimiter, array( | |
'bingo' => 'yes' | |
), array( | |
'file' => array( | |
'filename' => 'data.txt', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Using nginx version: nginx/1.6.2 and Laravel 5 | |
In the controller: | |
use Symfony\Component\HttpFoundation\StreamedResponse; | |
- - - - - - Some method - - - - - - - - - | |
$response = new StreamedResponse(); | |
$response->headers->set('Content-Type', 'text/event-stream'); | |
$response->headers->set('Cache-Control', 'no-cache'); | |
$response->setCallback( | |
function() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Build multipart/form-data | |
* | |
* @param array @$data Data | |
* @param array @$files 1-D array of files where key is field name and value if file contents | |
* @param string &$contentType Retun variable for content type | |
* | |
* @return string Encoded data | |
*/ | |
function buildMultipartFormData(array &$data, array &$files, &$contentType) |
- Install fish via Brew
- Optionally install Oh My Fish!
- Add fish to known shells
- Set default shell to fish
brew install fish
curl -L https://get.oh-my.fish | fish