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 () { | |
var hcpForm = $('#hcp_registration'); | |
if(hcpForm){ | |
var optional = $('#hcp_registration .optional'); | |
var hcpNameBlock = $('#hcp_name'); | |
var phone2Block = $('#phone2'); | |
var companyNameBlock = $('#company_name'); |
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
// http://codeforces.com/problemset/problem/118/B | |
function addSpace(str,time) { | |
var space=""; | |
for(var i = 0; i < time; i++)space+=" "; | |
return space+str+"\n"; | |
} | |
function createPalindromic(n){ | |
var line="",count=n-1; | |
for(var i = 0; i < n; i++){ | |
line+=(i).toString(); |
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 | |
Route::get('public/previewimages/{filename}', function ($filename) { | |
$storagePath = storage_path('app/images/'.$filename); | |
\Log::debug($storagePath); | |
if(!\File::exists($storagePath))return response("not found",404); | |
return response()->file($storagePath); | |
}); |
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 | |
public function getGraphics($where,$count=10){ | |
return Graphic::select(['title', | |
'content', | |
'graphics.user_id as user_id', | |
'graphics.id AS graphic_id', | |
'graphics.sub_category_id AS sub_category_id', | |
'sub_categories.category_id AS category_id', | |
'graphics.updated_at AS created_at', | |
'files.path','user.name','cat','subcat'])-> |
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
// destruct array elements in variables | |
let arr = [1,2,3,4,5] | |
let [a,b] = arr | |
console.log(`a is ${a} and b is ${b}`) | |
//destruct array elements with skipping | |
let [a1, ,c]=arr | |
console.log(`a is ${a1} and b is ${c}`) |
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 | |
$paging_info=$this->paging->get_paging_info($this->search_model->search( | |
urldecode($query), | |
(array_key_exists($langauge,supported_languages())?$langauge:'en'),'count') | |
,9,intval($page_id),3); | |
if(isset($paging_info)&&is_array($paging_info)){ | |
$this->data['data']['projects']=$this->search_model->search( | |
urldecode($query), | |
(array_key_exists($langauge,supported_languages())?$langauge:'en'),'data',$paging_info['offset'],$paging_info['limit']); | |
$this->data['data']['page_num_array']=$paging_info['page_num_array']; |
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 | |
class Search_model extends CI_Model { | |
function search($query,$lang,$query_type,$offset=0,$limit=10){ | |
$terms=$this->get_search_terms($query); | |
$terms_count=count($terms); | |
$select_rank=""; | |
$select=$this->get_select($query_type); | |
$where=""; | |
$join=$this->get_join(); |
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 | |
class Paging { | |
public function get_paging_info($row_count, $page_length = 10, $page_num = 1, $max_page_num = 5) { | |
$count = $row_count; | |
if ($count == 0) { | |
return "no data"; | |
} | |
$page_num = $this->page_num_validation ( $page_num ); | |
$pages_count = $this->pages_count_validation ( ($count / $page_length) ); | |
$offset = $page_length * ($page_num - 1); |
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
// https://projecteuler.net/problem=2 | |
var getSumOfEvenFibonacciNum = function (limit){ | |
var evenNum=2,prevEvenNum=0,sumOfEvenFibonacciNum=evenNum; | |
while (evenNum<=limit){ | |
var tempEvenNum=evenNum; | |
evenNum=(evenNum*4)+prevEvenNum; | |
if(evenNum>limit) break; | |
prevEvenNum=tempEvenNum; | |
sumOfEvenFibonacciNum+=evenNum; | |
} |
NewerOlder