Skip to content

Instantly share code, notes, and snippets.

View raihan-uddin's full-sized avatar
🎯
Focusing

Md. Raihan Uddin raihan-uddin

🎯
Focusing
View GitHub Profile
@raihan-uddin
raihan-uddin / active_record.md
Created October 27, 2020 09:52 — forked from yesnik/active_record.md
Yii 1 Framework Cookbook

CActiveRecord methods

findAll()

Sort records

// Ascending order
Partner::model()->findAll(array('order' => 'company'));
@raihan-uddin
raihan-uddin / pushnotification.php
Created September 29, 2020 04:33
PHP FIREBASE PUSH NOTIFICATION
<?php
function sendPushNotification($to = '', $data = array()){
$apiKey = '';
$fields = ['to' => $to, 'notification' => $data];
$headers = ['Authorization: key='.$apiKey, 'Content-Type: application/json'];
$url = 'https://fcm.googleapis.com/fcm.send';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
@raihan-uddin
raihan-uddin / calculator.py
Created September 28, 2020 09:50
PYTHON CONSOLE CALCULATOR
"""
Functions available are:
--------------------------------------------
+ : addition
- : subtraction
* : multiplication
/ : division
% : percentage
"""
import sys
@raihan-uddin
raihan-uddin / simple-html-menu.html
Created June 22, 2020 16:49
html, css, navigation
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.main {
width: 100%;
background: #eee;
}
@raihan-uddin
raihan-uddin / jquery file upload
Created June 8, 2020 07:04
jquery file upload
jQuery(document).ready(function ($) {
$("#btnPurchase").click(function (event) {
event.preventDefault(); // stopping submitting
var formData = new FormData($('form')[0]);
var data = $("#Purchaseasset").serializeArray();
var url = $("#Purchaseasset").attr('action');
$.ajax({
url: url,
type: 'post',
data: formData,
@raihan-uddin
raihan-uddin / yii1-rights-superadmin-permission
Created May 11, 2020 06:03
yii1-rights-superadmin-permission
INSERT INTO `AuthAssignment` (`itemname`, `userid`, `bizrule`, `data`) VALUES ('Admin', '1', NULL, 'N');
INSERT INTO `AuthItem` (`name`, `type`, `description`, `bizrule`, `data`) VALUES ('Admin', 0, 'Admin', NULL, 'N;');
<style type="text/css">@import url("https://fonts.googleapis.com/css?family=Orbitron");
.alarm-clock {
position: relative;
padding: 10px;
border-radius: 10px;
background-color: tan;
}
.alarm-clock .date {
@raihan-uddin
raihan-uddin / digital-clock.php
Created April 19, 2020 04:10
Digital Clock
<style type="text/css">
/* Google font */
@import url('https://fonts.googleapis.com/css?family=Orbitron');
#digit_clock_time {
font-family: 'Work Sans', sans-serif;
color: #66ff99;
font-size: 35px;
text-align: center;
padding-top: 20px;
//$months = [1 => 'Final Sale', 2 => 'Quotation'];
$months = array(1 => 'Jan.', 2 => 'Feb.', 3 => 'Mar.', 4 => 'Apr.', 5 => 'May', 6 => 'Jun.', 7 => 'Jul.', 8 => 'Aug.', 9 => 'Sep.', 10 => 'Oct.', 11 => 'Nov.', 12 => 'Dec.');
echo $form->dropDownList($model, 'month', $months, array('prompt' => 'Select'));
/* year for loop*/
$year = array();
for ($i=0; $i < 10; $i++){
$y = 2020+$i;
$year[$y] = $y;
function generatePassword($length=9, $strength=0) {
$vowels = 'aeuy';
$consonants = 'bdghjmnpqrstvz';
if ($strength >= 1) {
$consonants .= 'BDGHJLMNPQRSTVWXZ';
}
if ($strength >= 2) {
$vowels .= "AEUY";
}
if ($strength >= 4) {