(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
<?php | |
/** | |
* BITWISE FLAGS for Custom PHP Objects | |
* | |
* @link http://php.net/manual/en/language.operators.bitwise.php#108679 | |
* | |
* Sometimes I need a custom PHP Object that holds several boolean TRUE or FALSE values. | |
* I could easily include a variable for each of them, but as always, code has a way to | |
* get unweildy pretty fast. A more intelligent approach always seems to be the answer, |
KEYBINDINGS | |
byobu keybindings can be user defined in /usr/share/byobu/keybindings/ (or within .screenrc if byobu-export was used). The common key bindings | |
are: | |
F2 - Create a new window | |
F3 - Move to previous window | |
F4 - Move to next window |
[alias] | |
recent = "!git for-each-ref --sort=-committerdate refs/heads/ --format='%(committerdate:short) %(refname:short)' | head -n 10" | |
co = checkout | |
cob = checkout -b | |
coo = !git fetch && git checkout | |
br = branch | |
brd = branch -d | |
brD = branch -D | |
merged = branch --merged | |
st = status |
<?php | |
/** | |
* GitHub webhook handler template. | |
* | |
* @see https://docs.github.com/webhooks/ | |
* @author Miloslav Hůla (https://github.com/milo) | |
*/ | |
$hookSecret = 's.e.c.r.e.t'; # set NULL to disable check |
/** | |
* The default capability required to use Meta Slider is 'edit_others_posts'. | |
* You can change this to a different capability by pasting the code below into | |
* your themes functions.php file. | |
* | |
* You can use the 'User Role Editor' plugin to add a custom capability to WordPress | |
* specifically for Meta Slider users. | |
*/ | |
function metaslider_change_required_role($capability) { | |
return 'metaslider_use'; // this is the ID of a custom capability added using User Role Editor |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
// this is the background code... | |
// listen for our browerAction to be clicked | |
chrome.browserAction.onClicked.addListener(function (tab) { | |
// for the current tab, inject the "inject.js" file & execute it | |
chrome.tabs.executeScript(tab.ib, { | |
file: 'inject.js' | |
}); | |
}); |
We will assume we have a package/project called https://github.com/foo/bar
Most redistributable packages are hosted on a version control website such as Github or Bitbucket. Version control repositories often have a tagging system where we can define stable versions of our application. For example with git we can use the command:
git tag -a 1.0.0 -m 'First version.'
With this we have created version 1.0.0 of our application. This is a stable release which people can depend on. If we wanted to include "foo/bar" then we could create a composer.json
and specify the tagged release we wanted:
I recently had the following problem:
We didn't want to open the MySQL port to the network, but it's possible to SSH from the Jenkins machine to the MySQL machine. So, basically you would do something like
ssh -L 3306:localhost:3306 remotehost
# although StackOverflow has this answer http://stackoverflow.com/a/1128583 | |
# but that code is unreadable, thus I have this (also based on a SO anower: http://stackoverflow.com/a/1128721 ) | |
# get the name of the branch we are on | |
_git_repo_name() { | |
gittopdir=$(git rev-parse --git-dir 2> /dev/null) | |
if [[ "foo$gittopdir" == "foo.git" ]]; then | |
echo `basename $(pwd)` | |
elif [[ "foo$gittopdir" != "foo" ]]; then | |
echo `dirname $gittopdir | xargs basename` |