virtualenv open-env source open-env/bin/activate touch requirements.txt nano requirements.txt django==1.10.5 djangorestframework psycopg2 djangorestframework-jwt pip install -r requirements.txt django-admin startproject openx
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
// similar behavior as an HTTP redirect | |
window.location.replace("http://sidanmor.com"); | |
// similar behavior as clicking on a link | |
window.location.href = "http://sidanmor.com"; | |
//get value of a input item(of a id) using raw js | |
document.getElementById('inputID').value; | |
//get value of a input item(of a name) using raw js |
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
#it's the system's default database connection | |
from django.db import connection | |
def use_raw_query(self): | |
#raw sql query here | |
query = "SELECT * FROM `table` WHERE `row`= 1 " | |
#a cursor object | |
with connection.cursor() as cursor: | |
#execute the query |
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
Options +FollowSymLinks | |
RewriteEngine on | |
#here http://www.ainixon.me/rss/ is the new domain link where we want to redirect all our traffic. | |
RewriteRule (.*) http://www.ainixon.me/rss/ [R=301,L] |
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 | |
// this is the file structure of the command file. | |
// src/SmsBundle/Command/SendSmsCommand.php | |
namespace SmsBundle\Command; | |
use Symfony\Component\Console\Command\Command; | |
use Symfony\Component\Console\Input\InputInterface; | |
use Symfony\Component\Console\Output\OutputInterface; | |
//we need this to take inputs from the console. | |
use Symfony\Component\Console\Input\InputArgument; |
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
function toBangla (str) | |
{ | |
//check if the `str` is not string | |
if(!isNaN(str)){ | |
//if not string make it string forcefully | |
str = String(str); | |
} | |
//start try catch block | |
try { |
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 | |
function toBangla ($str) | |
{ | |
$convert = array ( | |
'0' => '০', | |
'1' => '১', | |
'2' => '২', | |
'3' => '৩', | |
'4' => '৪', | |
'5' => '৫', |
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
<style> | |
body { | |
} | |
table | |
{ | |
width: 100%; | |
} | |
table,th,td |
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
//if expected template available in string formate | |
if($string1) | |
{ | |
//write the expected template in a unique html file | |
write_file("uploads/$classId/Result-$classId-part$number.html", $string1); | |
//make the unique url for the html | |
$fileUrl = base_url()."uploads/$classId/Result-$classId-part$number.html"; | |
//run exec funtion and fee the html link to wkhtml function with requed pdf link(unique) | |
exec('"C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe" '.$fileUrl. ' uploads/'.$classId.'/'.$number.".pdf"); | |
//after execution remove the html file |
This gist assumes:
- you have a local git repo
- with an online remote repository (github / bitbucket etc)
- and a cloud server (Rackspace cloud / Amazon EC2 etc)
- your (PHP) scripts are served from /var/www/html/
- your webpages are executed by apache
- apache's home directory is /var/www/