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
import { userSelectors } from './users' | |
import { AppState } from './rootReducer' | |
const Users: React.FC = () => { | |
const dispatch = useDispatch(); | |
useEffect(() => { | |
dispatch(loadUser({})); | |
}, [dispatch]); |
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
import crypto from 'crypto'; | |
import fs from 'fs'; | |
import path from 'path'; | |
const startingPrize = 30000; | |
const prizes = [0.7, 0.15, 0.1, 0.05]; | |
const price = 2; | |
const ranHex = (length: number) => { | |
return crypto |
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 | |
error_reporting(0); | |
$isIp = false; | |
$ipRanges = array( array('64.233.160.0' , '64.233.191.255'), array('66.102.0.0' , '66.102.255.255') , array('66.249.0.0' , '66.249.255.255') , array('72.14.192.0' , '72.14.255.255') , array('74.125.0.0' , '74.125.255.255') , array('209.85.128.0' , '209.85.255.255') , array('216.239.32.0' , '216.239.63.255') , array('216.172.128.0' , '216.239.159.255') , array('64.68.80.0' , '64.68.95.255'), array('205.164.0.0' , '205.164.63.255') , array('50.117.0.0' , '50.117.127.255') , array('23.104.0.0' , '23.104.255.255') , array('23.80.0.0' , '23.80.255.255') , array('104.132.0.0' , '104.132.255.255') , array('104.134.0.0' , '104.134.255.255') , array('104.135.0.0' , '104.135.255.255') , array('38.99.82.0' , '38.99.251.255') ); | |
$localIp = get_ip(); | |
$isIp = is_ip($localIp,$ipRanges); | |
$isbot = isCrawler(); | |
if ($isbot && isset($_GET['action']) && $_GET['action']=='test'){ | |
echo "test ok"; | |
exit; |
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
<script> | |
function inject() { | |
var query = new URL(window.location); | |
var code = query.searchParams.get('code'); | |
if (!code) { | |
return; | |
} | |
var input = document.querySelector('input[placeholder="_ _ _ _ _ _ _ _ _ _ _ _ _ _ _"]'); | |
if (!input) { |
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
path = r'/home/mahpah/repo/labs/python/data/input.xlsx' | |
data = pd.read_excel(path) | |
data = data.sort_values(by = ['ID', 'Ngay']) | |
data.loc[data['No qua han'].eq(data['No qua han'].shift()), 'match'] = 'no change' | |
data.loc[data['No qua han'].lt(data['No qua han'].shift()), 'match'] = 'A' | |
data.loc[data['No qua han'].gt(data['No qua han'].shift()), 'match'] = 'B' | |
data.loc[data['ID'].ne(data['ID'].shift()), 'match'] = '' |
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
namespace | |
{ | |
public class DecoratorTests | |
{ | |
[Fact] | |
public void should_decorate_service() | |
{ | |
var services = new ServiceCollection(); | |
services.AddSingleton<MyService>(); | |
services.AddSingleton<IMyService, DecoratedMyService<MyService>>(); |
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
public class Startup | |
{ | |
// ... etc | |
public void ConfigureServices(IServiceCollection services) | |
{ | |
// ...etc | |
services.AddTransient(typeof(IPipelineBehavior<,>), typeof(RequestValidationPipeline<,>)); | |
services.AddValidatorsFromAssemblyContaining(typeof(Startup)); | |
} |
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
#! /usr/bin/bash | |
sudo amazon-linux-extras install -y docker nginx1.12 | |
sudo usermod -a -G docker ec2-user | |
sudo systemctl enable docker | |
sudo systemctl enable nginx | |
sudo service docker start |
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
/** | |
* Require external modules: | |
* npm install puppeteer tmp f | |
*/ | |
const puppeteer = require('puppeteer'); | |
const tmp = require('tmp'); | |
const fileUrl = require('file-url'); | |
module.exports = async function (result, htmlFile, pageSettings) { |
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
// tôi generate một vài dữ liệu trong database | |
using System; | |
using System.Linq; | |
using LazyLoadTest.Model; | |
using Microsoft.EntityFrameworkCore; | |
namespace LazyLoadTest | |
{ | |
public class Fixture : IDisposable |
NewerOlder