Skip to content

Instantly share code, notes, and snippets.

View bagaswidodo's full-sized avatar

Bagas Widodo bagaswidodo

  • Corporate, Tbk
  • Greater Jakarta, Indonesia
View GitHub Profile
composer create project laravel
npm install
php artisan key:generate
php artisan:migrate
composer require laravel/ui
php artisan ui vue --auth
php artisan migrate
@bagaswidodo
bagaswidodo / index.html
Last active January 17, 2019 12:10
Validate password with no sequences
<p id="test"></p>
@bagaswidodo
bagaswidodo / autowrap.html
Created May 25, 2018 03:09
Auto wrap textfile if content doesn't have space
.wrapword{
white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
white-space: -webkit-pre-wrap; /*Chrome & Safari */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
white-space: pre-wrap; /* css-3 */
word-wrap: break-word; /* Internet Explorer 5.5+ */
word-break: break-all;
white-space: normal;
}
@bagaswidodo
bagaswidodo / JsonReader.java
Created April 19, 2018 14:33
Consume REST JAVA
package com.bagaswidodo.test;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
@bagaswidodo
bagaswidodo / test_mail.java
Created November 3, 2017 19:56
Java Mail Sending
import java.util.Properties;
import javax.mail.*;
import javax.mail.internet.*;
// http://www.azertech.net/content/sending-email-using-javamail-package
public class test_mail
{
public static void main(String[] args) throws AddressException, MessagingException
{
@bagaswidodo
bagaswidodo / 1
Last active July 5, 2017 03:45
Close tab problem trace
coderanch.com/t/454062/java/session-multi-tabs-browser
Hi,
Using window.name javascript property we can track tabs/windows in the same session. I successfully used window.name in my application to track & do necessary action when application is accessed from multiple tabs.
Implementation details to restrict multi tabs access:
On Login page submit, set the window.name property to some value. Pass the same value as a hidden variable to Login action.
With this we can always ensure that proper login attempt window will have a name associated with it.
You have to put a check in Login action. If the value is not there in the session, it means 1st time you are trying to login in the session. Put the value in the session. If value already exist in the session, it means you are trying to login from another tab in the same session.
if(sessionmap.get("WINDOW_NAME") == null){
@bagaswidodo
bagaswidodo / completed-guide.txt
Last active May 23, 2017 04:14
All about client side invalidate session example.
=====
aku gak tahu pastinya. tapi algoritmanya kira2 begini. ketika kita diatrahkan oleh ke url ke halaman itu,
halaman akan menggenerate kode token yg disertakan di tiap tautan serbagai patamater url yg dienkripsi dan
disimpan sebagai sesi, nah ketika kita klik tombol, patrameter tersebut dikirimkan dan dicocokkan dengan sessi yg tersimpan.
jadi mirip dengan login dengan captcha, bedanya kalo captcha harus diinput manual, kalo ini disertakan dalam parameter url.
sekali lagi ininanalusaku. yg sebenarnya aku kurang tahu
======================
@bagaswidodo
bagaswidodo / en.java
Created February 3, 2017 11:29
Terbilang
import java.text.DecimalFormat;
public class EnglishNumberToWords {
private static final String[] tensNames = {
"",
" ten",
" twenty",
" thirty",
" forty",
@bagaswidodo
bagaswidodo / hp.txt
Created December 4, 2016 14:38
Read Text File PHP
0856
0888
0878
0812
@bagaswidodo
bagaswidodo / business-models.md
Created November 14, 2016 14:57 — forked from ndarville/business-models.md
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google