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
Homebrew Setup | |
If you've not already installed Homebrew, you can follow the instructions at http://brew.sh. I used to include the command in previous walkthrough blogs, but it could change after posting, so definitely check their website to install it properly. | |
If you do not have git available on your system, either from Homebrew, Xcode, or another source, you can install it with Homebrew now (if you already have it installed, feel free to skip this step to keep the version of git you already have): | |
brew install -v git | |
PATH Variable | |
In previous guides on 10.9 and earlier, I added a change to $PATH in ~/.bash_profile to ensure that Homebrew-installed applications would run by default over similar ones that were already installed on OS X. Thankfully, Yosemite's $PATH order is different than earlier OS versions and now includes the default Homebrew location of /usr/local/bin in front. If you installed Homebrew to a custom location, or are not seeing /usr/local/bin at the beginning of your shell's $PATH, chec |
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
For security code, please don't generate your tokens this way: `$token = md5(uniqid(rand(), TRUE));` | |
* [`rand()` is predictable](https://jazzy.id.au/2010/09/20/cracking_random_number_generators_part_1.html) | |
* [`uniqid()` only adds up to 29 bits of entropy](http://securitymaverick.com/php-uniqid-entropy-analysis-and-potentially-vulnerable-apps) | |
* `md5()` doesn't add entropy, it just mixes it deterministically | |
Try this out: | |
## Generating a CSRF Token | |
### PHP 7 |
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
# macOS Sierra v. 10.12 Setup | |
[View a more detailed explanation of these steps here.](https://www.taniarascia.com/setting-up-a-brand-new-mac-for-development/) | |
This is a simple list of instructions to make setting up your Apple computer as fast and efficient as possible for front end web development. | |
## Preferences | |
- **Keyboard > Text >** Disable "Correct spelling automatically". | |
- **Security and Privacy > Firewall >** On |
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
Installing memcached on Mac with Homebrew and Lunchy | |
This is a quick guide for installing memcached on a Mac with Homebrew, and starting and stopping it with Lunchy. I hope this tutorial will get your memcached up and running in no time. | |
Step 1 — Install Homebrew | |
Installing Homebrew is super easy. Just paste this in your terminal — | |
$ ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)" | |
You should also make sure your Homebrew is up-to-date. Use update and doctor commands to update and fix any issues it may have. |
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
<?php | |
/** | |
* Created by PhpStorm. | |
* User: thiphariel | |
* Date: 15/08/17 | |
* Time: 19:40 | |
*/ | |
namespace App\Api; |
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 | |
/* ---------------------------------------------------------- */ | |
/* minibots.class.php Ver.1.9g */ | |
/* ---------------------------------------------------------- */ | |
/* Mini Bots class is a small php class that allows you to */ | |
/* use some free web seriveces online to retrive usefull data */ | |
/* and infos. This version includes: */ | |
/* smtp validation, check spelling, meteo, exchange rates, */ | |
/* shorten urls, and geo referencing with IP address and more */ | |
/* Feel free to use in your applications, but link my blog: */ |
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 | |
// date | |
$date = '423523463463'; // time stamp | |
$date = date("F j, Y, g:i a", $date); | |
// satring to date | |
$str = strtotime('10/16/2016'); | |
$date = date('M d Y',$str); | |
echo $date; |
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 | |
/** | |
* Youtube link embed conversion | |
* | |
* https://img.youtube.com/vi/<insert-youtube-video-id-here>/0.jpg | |
* https://img.youtube.com/vi/<insert-youtube-video-id-here>/1.jpg | |
* https://img.youtube.com/vi/<insert-youtube-video-id-here>/2.jpg | |
* https://img.youtube.com/vi/<insert-youtube-video-id-here>/3.jpg | |
* | |
* https://img.youtube.com/vi/<insert-youtube-video-id-here>/default.jpg |
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 | |
print '<pre>'; | |
class parserXPath extends DOMXPath { | |
private function getPage($url){ | |
$ch = curl_init(); | |
curl_setopt ($ch , CURLOPT_URL , $url); | |
curl_setopt ($ch , CURLOPT_USERAGENT , "Mozilla/5.0"); | |
curl_setopt ($ch , CURLOPT_RETURNTRANSFER , 1 ); | |
// можете добавить кучу других опций |
OlderNewer