Skip to content

Instantly share code, notes, and snippets.

View farindra's full-sized avatar

Farindra farindra

View GitHub Profile
@farindra
farindra / index.php
Last active August 29, 2015 14:19
auto reload div by jquery from php
<html>
<head>
<title>auto reload div by jquery from php</title>
</head>
<body>
<center><strong><u>This is Realtime data : </u></strong></br>
<div id=content_div_id></div>
</center>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
@farindra
farindra / getmondaydate
Created April 22, 2015 02:26
get monday date of the week SQL Server
DECLARE @mydate DATETIME,@devval VARCHAR(50)
set @devval='2015-04-01'
SELECT @mydate = GETDATE()
-- Monday of Current Week
SELECT DATEADD(WEEK, DATEDIFF(WEEK, 0, @devval), 0),
'Monday of Current Week'
@farindra
farindra / yii2_field_1
Last active August 29, 2015 14:23
yii2 costum field 1
<?//= $form->field($model, 'nm_menu', ['template' => "{label}\n<i class='fa fa-user'></i>\n{input}\n{hint}\n{error}"])->textInput(array('placeholder' => 'Username')); ?>
@farindra
farindra / idtrigger
Created June 22, 2015 09:55
trigger auto id number
begin
DECLARE id_old,id_new INT(11);
DECLARE id_var varchar(20);
SELECT ifnull(right(MAX(kd_berita),4),'0000') into id_var from a1000 where status
set id_old=cast( id_var as unsigned);
set id_new= id_old+1;
SET id_var = '';
SET id_old = 1;
begin
DECLARE id_old,id_new INT(11);
DECLARE id_var varchar(20);
SELECT ifnull(right(MAX(kd_berita),4),'0000') into id_var from a1000 where month(CURDATE())=month(created_at);
set id_old=cast( id_var as unsigned);
set id_new= id_old+1;
SET id_var = '';
SET id_old = 1;
@farindra
farindra / pb_macro.vb
Created September 29, 2015 08:10
Excel PB1 Macro
Sub Gabung()
On Error Resume Next
Dim i As Long, iMatches As Long, j As Integer
Dim aTokens() As String: aTokens = Split("reply,response", ",")
Dim AA As String
For j = 1 To 31
If j < 10 Then AA = "0" & Trim(Str(j)) Else AA = Trim(Str(j))
For Each cell In Sheets(AA).Range("A5:A1000")
<?php
error_reporting(E_ALL);
echo "<h2>TCP/IP Connection</h2>\n";
/* Get the port for the WWW service. */
$service_port = getservbyname('www', 'tcp');
/* Get the IP address for the target host. */
$address = gethostbyname('www.example.com');
@farindra
farindra / htaccess.public.readme
Last active November 14, 2019 06:22
htaccess laraver mode
Don't get confused with other option the snippet below I am using and will be useful for you too. Put the below htacces in your root.
<IfModule mod_rewrite.c>
RewriteEngine on
# Force SSL
#RewriteCond %{HTTPS} !=on
#RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]
@farindra
farindra / goto.sh
Created May 21, 2016 23:30
Fungi GOTO Label
function jumpto
{
label=$1
cmd=$(sed -n "/$label:/{:a;n;p;ba};" $0 | grep -v ':$')
eval "$cmd"
exit
}
start=${1:-"start"}
@farindra
farindra / abi_1_0.sh
Created May 23, 2016 09:48
ARD BASH INSTALLER Ver. 1.0 (beta)
#!/usr/bin/env bash
# OS VERSION: CentOS 6.x + Minimal
# ARCH: 32bit + 64bit
ARD_BASH_INSTALLER=1.0
#blok fungsi
#==============================================================