Skip to content

Instantly share code, notes, and snippets.

@Peelz
Peelz / web.php
Last active June 12, 2018 05:35
initial route laravel
<?php
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
@Peelz
Peelz / base64Storage.php
Last active July 17, 2018 09:13
base 64 to blob storage
public function base64Storage($input, $destination, $rename = "")
{
list($type, $data) = explode(';', $input);
list(, $data) = explode(',', $data);
$data = base64_decode($data);
$file_name = sha1(time()) ;
$extention = explode('/', $type)[1] ;
$full_file_name = $file_name.'.'.$extention ;
@Peelz
Peelz / bash.sh
Created August 11, 2018 21:06
bash install docker on linux
# Environment variables you need to set so you don't have to edit the script below.
export DOCKER_CHANNEL=edge
export DOCKER_COMPOSE_VERSION=1.21.0
# Update the apt package index.
sudo apt-get update
# Install packages to allow apt to use a repository over HTTPS.
sudo apt-get install -y \
apt-transport-https \
@Peelz
Peelz / parse_yaml.sh
Created October 24, 2018 04:55 — forked from pkuczynski/parse_yaml.sh
Read YAML file from Bash script
#!/bin/sh
parse_yaml() {
local prefix=$2
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
awk -F$fs '{
indent = length($1)/2;
vname[indent] = $2;
for (i in vname) {if (i > indent) {delete vname[i]}}
#### db.js ####
import Realm from 'realm'
import Log from './schema/Log';
import Setting from './schema/Setting';
import UserProfile from './schema/UserProfile';
import { asyncGetEncyptionKey } from '../src/utils';
class db {
static realmInstance = null
import React, { useEffect } from "react";
import {
Text,
View,
SafeAreaView,
ScrollView,
StyleSheet,
TouchableOpacity,
Image,
Platform
{
"data": {
"type": "any",
"required": true
},
"meta": {
"response_code": {
"type": "string",
"pattern": "[0-9]{5}"
},
numCase = int(input())
for c in range(numCase):
size = int(input())
matrix = []
rowCount = 0
colCount = 0
tranceCount = 0
for i in range(size):
matrix.append(input().split(" "))
# row
def get_current_parentheses(current, previous, next):
before = ""
after = ""
if current == 0:
return "0"
if current == next:
pass
elif current > next:
after = ")" * (current - next)
# else:
@Peelz
Peelz / p3.in
Last active April 5, 2020 04:16
5
3
360 480
420 540
600 660
3
0 1440
1 3
2 4
5