Skip to content

Instantly share code, notes, and snippets.

<?php
$url = "http://vnreview.vn";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_REFERER, $url);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
@taisang1996
taisang1996 / phantich_giohang.php
Created July 15, 2016 08:36
gio hang cua thang sang
<?php
// index.php?module=themgiohang&masanpham=1
// quy luat
$_SESSION['giohang'] = [
['masanpham' => 1, 'soluong' => 5],
['masanpham' => 2, 'soluong' => 1],
['masanpham' => 5, 'soluong' => 2],
['masanpham' => 100, 'soluong' => 1],
@taisang1996
taisang1996 / grab.py
Last active July 18, 2016 05:39
grab content from dazzlepod.com (scan, whois, traceroute....)
import requests
import re
# Grab urls
r = requests.get("https://dazzlepod.com/ip/?ip_address=google.com");
urls = re.findall('url:\ ?"(.+)\"', r.content)
urls.pop(0)
urls.pop(-1)
print "Found ", len(urls)," url"
@taisang1996
taisang1996 / AuthController.php
Created August 1, 2016 10:11
Tùy chỉnh thông báo (messages) validation AuthController trên Laravel
<?php
// app/Http/Controllers/Auth/AuthController.php
protected function validator(array $data)
{
// Validator::make( array $data, array $rules, array $messages = array(), array $customAttributes = array())
return Validator::make($data, [
'name' => 'required|max:255',
@taisang1996
taisang1996 / bootstrap-breakpoints.sass
Created August 5, 2016 11:26 — forked from webinfinita/bootstrap-breakpoints.sass
Variables for responsive design in bootstrap with sass
@mixin breakpoint($point)
@if $point == lg
@media (min-width: 1200px)
@content
@else if $point == md
@media (min-width: 992px) and (max-width: 1199px)
@content
@else if $point == sm
@taisang1996
taisang1996 / hacked.html
Last active September 5, 2016 07:07
escapse hacked page
<script>
document.write(unescape('%3C%21%44%4F%43%54%59%50%45%20%68%74%6D%6C%3E%0A%3C%68%74%6D%6C%20%3E%0A%20%20%3C%68%65%61%64%3E%0A%20%20%20%20%3C%6D%65%74%61%20%63%68%61%72%73%65%74%3D%22%55%54%46%2D%38%22%3E%0A%20%20%20%20%3C%74%69%74%6C%65%3E%68%61%63%6B%65%64%3C%2F%74%69%74%6C%65%3E%0A%20%20%20%20%3C%6D%65%74%61%20%6E%61%6D%65%3D%22%76%69%65%77%70%6F%72%74%22%20%63%6F%6E%74%65%6E%74%3D%22%77%69%64%74%68%3D%64%65%76%69%63%65%2D%77%69%64%74%68%2C%20%69%6E%69%74%69%61%6C%2D%73%63%61%6C%65%3D%31%2C%20%75%73%65%72%2D%73%63%61%6C%61%62%6C%65%3D%6E%6F%2C%20%6D%69%6E%69%6D%61%6C%2D%75%69%22%3E%0A%20%20%20%20%0A%20%20%20%20%3C%73%74%79%6C%65%3E%0A%20%20%20%20%20%20%40%69%6D%70%6F%72%74%20%75%72%6C%28%68%74%74%70%3A%2F%2F%66%6F%6E%74%73%2E%67%6F%6F%67%6C%65%61%70%69%73%2E%63%6F%6D%2F%63%73%73%3F%66%61%6D%69%6C%79%3D%56%54%33%32%33%29%3B%0A%20%20%20%20%20%20%68%74%6D%6C%2C%62%6F%64%79%2C%64%69%76%2C%73%70%61%6E%2C%61%70%70%6C%65%74%2C%6F%62%6A%65%63%74%2C%69%66%72%61%6D%65%2C%68%31%2C%68%32%2C%68%33%2C%68%34%2C%6
@taisang1996
taisang1996 / get_access_token.js
Created November 15, 2016 10:02
Lấy access token
var url = "https://www.facebook.com/v1.0/dialog/oauth/confirm";
var data = 'fb_dtsg=' + document['getElementsByName']('fb_dtsg')[0]['value'] + '&app_id=165907476854626&redirect_uri=fbconnect://success&display=popup&access_token=&sdk=&from_post=1&private=&tos=&login=&read=&write=&extended=&social_confirm=&confirm=&seen_scopes=&auth_type=&auth_token=&auth_nonce=&default_audience=&ref=Default&return_format=access_token&domain=&sso_device=ios&__CONFIRM__=1';
var access_token = "";
var xhr = new XMLHttpRequest;
xhr.open('POST', url, true);
xhr.onreadystatechange = function() {
if (xhr.readyState == XMLHttpRequest.DONE && xhr.status == 200) {
@taisang1996
taisang1996 / crap.js
Created January 17, 2017 08:57
crap thông tin sản phẩm của maihoang.com.vn
const got = require('got')
const cheerio = require('cheerio')
let parseProductFromLink = (url) => {
url = encodeURI(url)
got(url)
.then(response => cheerio.load(response.body))
.then($ => {
$('.pro-item .pro-img a').map((i, a) =>
parseProductInfo($(a).attr('href'))
@taisang1996
taisang1996 / routes.php
Last active August 28, 2017 06:48
Fix một số lỗi cơ bản khi triển khai dự án laravel lên host
<?php
// Fix một số lỗi cơ bản khi đưa lên hosting
// do hosting không chạy được lệnh
// example.com/fix
Route::get('/fix', function() {
Artisan::call('cache:clear');
Artisan::call('config:clear');
Artisan::call('route:clear');
Artisan::call('view:clear');
Artisan::call('optimize');
@taisang1996
taisang1996 / scraping_link_thegioididong.js
Created February 11, 2017 09:15
Scraping link thegioididong with ajax :)