Skip to content

Instantly share code, notes, and snippets.

@DinVinchester
DinVinchester / GetSiteURLWithProtocol.php
Created December 10, 2018 12:51 — forked from ChrisMcKee/GetSiteURLWithProtocol.php
Get site url with current protocol
<?php
function siteURL()
{
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
$domainName = $_SERVER['HTTP_HOST'].'/';
return $protocol.$domainName;
}
define( 'SITE_URL', siteURL() );
REQUEST (MINIMAL DETAILS)
<s:Envelope xmlns:s='http://schemas.xmlsoap.org/soap/envelope/'>
<s:Body>
<ServiceRequest xmlns='http://tempuri.org/'>
<rqst xmlns:i='http://www.w3.org/2001/XMLSchema-instance'>
<Request i:type='HotelsServiceSearchRequest' xmlns=''>
<ClientIP i:nil='true'/>
<DesiredResultCurrency>USD</DesiredResultCurrency>
<Residency>US</Residency>
@DinVinchester
DinVinchester / anki_bulk_download.py
Created November 16, 2018 07:11 — forked from mikob/anki_bulk_download.py
Bulk download Japanese audio from JapanesePod101 and automatically update your anki deck to populate the audio field.
#!/usr/bin/env python3
'''
Make sure to backup your anki database before trying this script. You will definitely need to update
the CARD_TYPES before running.
'''
import sqlite3
from hashlib import sha1
# from anki.utils import fieldChecksum
import re
import sys
@DinVinchester
DinVinchester / gmaps-distance-miles.js
Created September 27, 2018 13:10 — forked from RadGH/gmaps-distance-miles.js
Google Maps JS API V3 - Get distance between two points in miles using the Geometry library.
/*
IMPORTANT:
You must edit the <script> for the Google Maps API to include the Geometry API library, by adding to the URL: &libraries=geometry
Example:
<script async defer src="https://maps.googleapis.com/maps/api/js?key=YOUR_KEY&libraries=geometry"></script>
*/
// Define two points using LatLng objects
var point_a = new google.maps.LatLng( 44.037307, -123.110091 );
@DinVinchester
DinVinchester / 1.php
Created August 7, 2018 11:57 — forked from mxriverlynn/1.php
laravel and kendo ui php
<?php
class HomeController extends BaseController {
public function showWelcome()
{
$users = User::all();
return View::make('hello')->with('users', $users);
}
@DinVinchester
DinVinchester / .bash_aliases
Created July 31, 2018 07:11 — forked from djravine/.bash_aliases
'.bash_aliases' - DEV - Change PHP Version
# Aliases - PHP
alias php.info='php -i'
alias php5.6='sudo a2dismod php7.0 && sudo a2dismod php7.1 && sudo a2dismod php7.2 && sudo a2enmod php5.6 && sudo update-alternatives --set php /usr/bin/php5.6 && sudo service apache2 restart'
alias php7.0='sudo a2dismod php5.6 && sudo a2dismod php7.1 && sudo a2dismod php7.2 && sudo a2enmod php7.0 && sudo update-alternatives --set php /usr/bin/php7.0 && sudo service apache2 restart'
alias php7.1='sudo a2dismod php5.6 && sudo a2dismod php7.0 && sudo a2dismod php7.2 && sudo a2enmod php7.1 && sudo update-alternatives --set php /usr/bin/php7.1 && sudo service apache2 restart'
alias php7.2='sudo a2dismod php5.6 && sudo a2dismod php7.0 && sudo a2dismod php7.1 && sudo a2enmod php7.2 && sudo update-alternatives --set php /usr/bin/php7.2 && sudo service apache2 restart'
@DinVinchester
DinVinchester / mysqldump.sql
Created July 19, 2018 10:01 — forked from tahirm/mysqldump.sql
mysqldump command to dump a remote database in locally. #db #sql #mysql #mysqldump #remote
mysqldump -u USER -p -h dev.incuray.com DATABASE > /path/to/output/file/DATABASE.sql;
@DinVinchester
DinVinchester / app.js
Created May 29, 2018 04:43 — forked from jalalhejazi/app.js
nodejs: Node create server and send data.json filecontent to client of CORS !
/*
Response header info:
Access-Control-Allow-Origin:*
Content-Type:text/json
X-Powered-By:nodejs
*/
var http = require('http');
var fs = require('fs');
@DinVinchester
DinVinchester / default
Created May 25, 2018 16:37 — forked from psgganesh/default
Simple lumen nginx conf
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
listen 443 ssl;
root /var/www/lumen/public;
index index.php index.html index.htm;
server_name server_domain_or_IP;
@DinVinchester
DinVinchester / nginx_nodejs.md
Created May 18, 2018 08:57 — forked from tomasevich/nginx_nodejs.md
Сервер в связке Nginx + NodeJs

Сервер в связке Nginx + NodeJs

Данная пошаговая инструкция поможет освоить основы на простом примере

Для справки

Сервер поднимался на Debian 8 c характеристиками:

CPU - 1 ядро x 500 МГц