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
# git prompt, for ~/.bashrc | |
GIT_PROMPT_ONLY_IN_REPO=1 | |
GIT_PROMPT_START_USER="\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]" | |
GIT_PROMPT_START_ROOT="${BoldRed}\u@\h${ResetColor}:${BoldBlue}\w${ResetColor}" | |
GIT_PROMPT_END_USER="\n$ " | |
GIT_PROMPT_END_ROOT="\n# " | |
source ~/.bash-git-prompt/gitprompt.sh |
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
var db = openDatabase('myDatabase', '', 'My database description', 5 * 1024 * 1024); | |
if (reinitDb) { | |
db.changeVersion(db.version, '', function(t) { | |
t.executeSql("SELECT name FROM sqlite_master WHERE type='table' and name not like '__Webkit%'", [], function(sqlTransaction, sqlResultSet) { | |
var table, tablesNumber = sqlResultSet.rows.length; | |
console.log('DATABASE RESET MODE ENABLED'); | |
for (var i = 0; i < tablesNumber; i++) { | |
table = sqlResultSet.rows.item(i); | |
console.log('Removing table: ' + table.name); |
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
<?php | |
/** | |
* Disable local delivery when a minimum amount is not reached. | |
* The minimum amount is the free shipping one. | |
*/ | |
function setMinimumAmountForLocalDelivery($isAvailable) { | |
// get cart amount : | |
if (WC()->cart->prices_include_tax) { | |
$cartAmount = WC()->cart->cart_contents_total + array_sum(WC()->cart->taxes); | |
} else { |
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
/* This CSS is for markdown-html */ | |
/* markdown-html -s "/path/to/markdown.css" -w "file.md" -o "file.html" */ | |
/* http://meyerweb.com/eric/tools/css/reset/ | |
v2.0 | 20110126 | |
License: none (public domain) | |
*/ | |
html, body, div, span, applet, object, iframe, | |
h1, h2, h3, h4, h5, h6, p, blockquote, pre, |
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 *:80> already open | |
RewriteEngine on | |
ReWriteCond %{SERVER_PORT} !^443$ | |
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L] | |
</virtualhost> | |
<VirtualHost *:443> | |
ServerAdmin zadmin@localhost | |
DocumentRoot "/etc/sentora/panel/" | |
ServerName your-server-address |
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
.remark-fading { | |
z-index: 9; | |
} | |
.remark-slide-container { | |
transition: opacity 1s linear, right 1s ease-in-out; | |
opacity: 0; | |
right: 1000px; | |
} | |
.remark-visible { | |
transition: opacity 1s linear, right 1s ease-in-out; |
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
<?php | |
/* Custom gallery output */ | |
function customGalleryOutput($output = "", $attr) { | |
// This part is globally copied from the WordPress gallery function | |
$return = $output; // fallback | |
$post = get_post(); | |
if ( ! empty( $attr['ids'] ) ) { | |
// 'ids' is explicitly ordered, unless you specify otherwise. | |
if ( empty( $attr['orderby'] ) ) |
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
<?php | |
/** | |
* Shift code to the left, preserving indentation. | |
* | |
* This is useful when reading code extract in a not-displayed nested structures. | |
* There is no use of closure here in order to remain compatible with older versions of PHP. | |
* This method is code agnostic. | |
* @example | |
* $code = ""; | |
* $code .= " while ($a) {"; |
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
<?php | |
// src/UsersManager.php | |
namespace Vendor\Users; | |
class UsersManager { | |
private $users = array(); | |
/** | |
* Add a user to the list | |
* @return User|boolean Return the created user object, or false if the user is not valid |
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 strict'; | |
/** | |
* Returns a clean copy of the provided object, in order to JSON.stringify it for example. | |
* | |
* It removes recursively methods and cyclic objects. | |
* Cyclic objects are references to a parent object of the property, for example: a.b.c = a; | |
* References to non-parent objects are kept, for example: a.b.c = 'hello'; a.d = a.b; | |
* @param any obj Any variable. When obj is not an object, it is returned as-is. | |
* @param array parents Parents list, for internal use. |
NewerOlder