Steps to deploy Node.js to VPS using PM2 and Github Actions
CREATE TABLE pokemon( | |
Number INTEGER, | |
Name TEXT PRIMARY KEY, | |
Type_1 TEXT, | |
Type_2 TEXT, | |
Total INTEGER, | |
HP INTEGER, | |
Attack INTEGER, | |
Defense INTEGER, | |
Sp_Atk INTEGER, |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" Small experiment with Python's operator overloading to add support for | |
composing function with the pipe operator similar to Elixir's pipe operator. | |
The main use case of such technique I see is to build isolated DSL. | |
This approach uses decorators to achieve the given result which forces you | |
to wrap all the functions you want to use this way. The runtime cost should | |
be minimal however this might be a problem in some context. It also prevents you |
<?php | |
class _╯°□°╯︵┻━┻ extends \Exception {} | |
function _╯°□°╯︵┻━┻($message) { | |
throw new _╯°□°╯︵┻━┻($message); | |
} | |
_╯°□°╯︵┻━┻("Flip Table"); |
In this tutorial we are going to show how easy it is to build a notification feed using GetStream.io. First of all, let's quickly introduce you to our fictional example app. It's called bug-your-friends.com and allows you interact with your friends, ping them, follow them or poke them. Here's a quick list of example interactions:
- poke another user (eg. Thierry pokes Alessandra)
- follow a user (eg. Tommaso follows Iris)
- ping a user (eg. Josie pings Carolina)
Whenever a user is part of one of these interactions, we want to update his notification feed, update the number of unseen and unread
# get bash completion for brew | |
if [ -f $(brew --prefix)/etc/bash_completion ]; then | |
. $(brew --prefix)/etc/bash_completion | |
fi | |
# git prompt | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \(\1\)/' | |
} |
'use strict'; | |
module.exports = function CustomError(message, extra) { | |
Error.captureStackTrace(this, this.constructor); | |
this.name = this.constructor.name; | |
this.message = message; | |
this.extra = extra; | |
}; | |
require('util').inherits(module.exports, Error); |
The final result: require() any module on npm in your browser console with browserify
This article is written to explain how the above gif works in the chrome (and other) browser consoles. A quick disclaimer: this whole thing is a huge hack, it shouldn't be used for anything seriously, and there are probably much better ways of accomplishing the same.
Update: There are much better ways of accomplishing the same, and the script has been updated to use a much simpler method pulling directly from browserify-cdn. See this thread for details: mathisonian/requirify#5
<?php | |
use http\Client, http\Client\Request; | |
use http\QueryString; | |
$params = new QueryString; | |
$params["foo"] = "bar"; | |
$params["bar"] = "foo"; | |
$request = new Request("POST", "http://example.com"); |