| gitflow | git |
|---|---|
git flow init |
git init |
git commit --allow-empty -m "Initial commit" |
|
git checkout -b develop master |
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
| function _alphaOnly($value) | |
| { | |
| return preg_replace('/[^[:alnum:]\-\.]/u', '', $value); | |
| } | |
| /** | |
| * @param $number | |
| * | |
| * @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
| desc "Create about and revision files." | |
| task :rev_deployment, :roles => [:app, :web] do | |
| require 'grit' | |
| require 'chronic' | |
| # include Grit | |
| work_dir = File.join(File.dirname(__FILE__), '../../') | |
| g = Grit::Repo.new(work_dir) | |
| since = Chronic.parse('last week friday') | |
| msg = "\n" | |
| rev_file = File.join(File.dirname(__FILE__), '../../','tmp/revision.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
| export const responsiveText = (selector) => { | |
| const rtWrappers = document.querySelectorAll(selector) | |
| rtWrappers.forEach(wrapper => { | |
| const width = wrapper.offsetWidth, | |
| height = wrapper.offsetHeight, | |
| text = wrapper.innerHTML | |
| let textLength = typeof text === "string" ? text.trim().replace(" ", "").length : 0 |
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
| let mix = require('laravel-mix'); | |
| let httpRequest = require('request') | |
| let criticalCSS = require('critical') | |
| //Run your asset compilation commands... | |
| //Then we will generate critical css... | |
| mix.then(()=>{ | |
| console.log("Build Post-Processing...") | |
| const criticalRoutes = [ |
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
| export const kebabToPascalCase = str.replace(/(?:^\w|[A-Z]|\b\w)/g, (letter, index) => letter.toUpperCase()).replace(/[^\w]+/g, ""); | |
| // eg: some-string => SomeString | |
| export const toNepaliNumber = n => (n + '').replace(/\d/g, i => '०१२३४५६७८९'[i]) | |
| export const numberToWord = amount => { | |
| const a = ["", "One ", "Two ", "Three ", "Four ", "Five ", "Six ", "Seven ", "Eight ", "Nine ", "Ten ", "Eleven ", "Twelve ", "Thirteen ", "Fourteen ", "Fifteen ", "Sixteen ", "Seventeen ", "Eighteen ", "Nineteen"]; | |
| const b = ["", "Ten", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"]; | |
| amount = (amount.toFixed(2)).toString().split("."); |
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 class to convert number to words in php based on http://www.karlrixon.co.uk/writing/convert-numbers-to-words-with-php/ | |
| if ( !class_exists('NumbersToWords') ){ | |
| /** | |
| * NumbersToWords | |
| */ | |
| class NumbersToWords{ | |
| public static $hyphen = '-'; | |
| public static $conjunction = ' and '; |
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
| function cryptoUniqid(string $prefix = '', bool $prng = false): string | |
| { | |
| static $nonce = null; | |
| if($prng || is_null($nonce)) { | |
| $nonce = random_bytes(16); | |
| } else { | |
| sodium_increment($nonce); | |
| } | |
| $m = microtime(true); | |
| $return = sprintf("%8x%05x", floor($m), ($m-floor($m))*1000000); |
There are some small changes you can make to make your website faster, and a little more secure.
The original configuration will keep you safe, but it is always good to see what else can be done.
By default, the nginx.conf will return "403 Forbidden" errors for system files that are not supposed to be accessed directly. However, there's a good alternative, like so:
- To prints detailed information about all PCI buses and devices in the system
$ lspci
to get specific pci buses info
$ lspci | grep -i nvidia