This file contains 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains 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
<VirtualHost localhost:80> | |
DocumentRoot "default/site/directory" | |
ServerName localhost | |
ErrorLog "logs/dummy-host2.example.com-error.log" | |
CustomLog "logs/dummy-host2.example.com-access.log" common | |
</VirtualHost> | |
<VirtualHost mysite.loc:80> | |
DocumentRoot "mysite/path" | |
ServerName mysite.loc |
This file contains 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
// In codeigniter, form_open() can automatic output a csrf token field. | |
// But, I prefer use the html form tag. | |
// This function can manually insert a token to form elements. | |
function csrf_token() | |
{ | |
$CI = & get_instance(); | |
$hidden[$CI->security->get_csrf_token_name()]= $CI->security->get_csrf_hash(); | |
$form_token = sprintf("<div style=\"display:none\">%s</div>", form_hidden($hidden)); | |
echo $form_token; | |
} |
This file contains 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
// Put those lines in application/config/config.php | |
$csrf_ignore = [ | |
'/page1.html', | |
'/about.html' | |
]; | |
$is_csrf_condition_met = true; | |
foreach($csrf_ignore as $ci){ |
This file contains 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
@echo off | |
SET AppKey=SublimeText3 | |
SET AppTitle=Sublime Text 3 | |
SET AppPath=D:\Program Files\st\sublime_text.exe | |
SET AppIcon=%AppPath%,0 | |
REG ADD "HKEY_CLASSES_ROOT\*\shell\%AppKey%" /ve /f /d "%AppTitle%" | |
REG ADD "HKEY_CLASSES_ROOT\*\shell\%AppKey%" /v "Icon" /f /d "%AppIcon%" | |
REG ADD "HKEY_CLASSES_ROOT\*\shell\%AppKey%\command" /ve /f /d "%AppPath% \"%%1\"" |
This file contains 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 round(value, decimals) { | |
return Number(Math.round(value+'e'+decimals)+'e-'+decimals); | |
} | |
//round(1.005, 2); | |
// 1.01 |
This file contains 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
# See http://help.github.com/ignore-files/ for more about ignoring files. | |
# compiled output | |
/dist | |
/tmp | |
*.cache | |
# dependencies | |
node_modules |
This file contains 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
:: Ensure the two sublime text folders are moved into drobox first. | |
:: Sublime text uses links to work. | |
mklink /j "D:\Program Files\st3\Data\Packages" "E:\Dropbox\st\Data\Packages" | |
mklink /j "D:\Program Files\st3\Data\Installed Packages" "E:\Dropbox\st\Data\Installed Packages" | |
:: Dropbox uses links to sync vs code. | |
:: In vs code, custom keymap should be done with keybindings.json, otherwise they won't be saved to dropbox. | |
mklink /j "E:\Dropbox\code\User" "%appdata%\Code\User" | |
mklink /j "E:\Dropbox\code\.vscode" "%USERPROFILE%\Code\.vscode" |
This file contains 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
/** | |
* Insert <text> to <areaId>, then [selectedText] will be selected. | |
* | |
* @export module.insertAtCaret | |
* @param {string} areaId - ID of textarea | |
* @param {string} text - text to be inserted | |
* @param {string} [selectedText=undefined] - a sub string of param <text>, | |
* will be selected after insertion, and also be replaced by the current selected text in textarea | |
*/ | |
export function insertAtCaret (areaId, text, selectedText = undefined) { |
This file contains 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
Show hidden characters
{ | |
"presets": [ | |
[ | |
"env", | |
{"modules": false} | |
], | |
["stage-3"] | |
], | |
"plugins": ["transform-runtime"], | |
"env": { |
OlderNewer