Skip to content

Instantly share code, notes, and snippets.

View angarsky's full-sized avatar

Evgeniy Melnikov angarsky

View GitHub Profile
@angarsky
angarsky / gist:0f9e0162740a7f4c6bf8710f4a54edc9
Created October 22, 2019 20:58
A Promise test for React apps
const promise = new Promise(function(resolve) {
setTimeout(resolve, 3000);
})
.then(() => {
console.log('After 3 sec!');
});
@angarsky
angarsky / docker-compose.yml
Created September 13, 2019 14:03
How to run app's code through a web server
version: '2'
services:
nginx:
image: nginx
ports:
- 8888:80
volumes:
- ./:/usr/share/nginx/html
restart: always
@angarsky
angarsky / gist:19f2d6eb0f311fb7d04b01af5e5cee53
Created August 22, 2019 15:15
Solr demo instance with Docker
docker run --name my_solr -d -p 8983:8983 -t solr:8.2.0
docker exec -it --user=solr my_solr bin/solr create_core -c techproducts
docker exec -it --user=solr my_solr bin/post -c techproducts example/exampledocs/
@angarsky
angarsky / gist:9f43e9fcccfc7fbb3a8242fedc6fe03e
Created May 29, 2017 10:37
Example of code to make an API call with Access Token
$client_id = '';
$client_secret = '';
$endpoint = "http://site.dev";
if (!isset($_GET['access_token'])) {
print 'Access token is not define.';
die;
}
$curl = curl_init($endpoint . '/api/sso/v0.1/user/profile');
$client_id = '';
$client_secret = '';
$endpoint = "http://site.dev";
$curl = curl_init($endpoint . '/oauth2/token');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_HEADER,'Content-Type: application/x-www-form-urlencoded');
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
/**
* Implements hook_menu().
*/
function ftop_menu_alters_menu() {
$base_404 = array(
'page callback' => '_ftop_menu_alters_redirect',
'page arguments' => array(0),
'access callback' => TRUE,