Skip to content

Instantly share code, notes, and snippets.

View 4sskick's full-sized avatar
🏠
Working from home

tian 4sskick

🏠
Working from home
View GitHub Profile
@4sskick
4sskick / RUST - initial setup
Last active July 6, 2023 04:04
RUST setup initial project from installation until run on first time
View RUST - initial setup
there's already a bunch of tutorial setup on internet up there. I will just covering some in my version from creating new project till run on as debug. I am using wsl2 on win11.
Following the steps on book Zero to production in RUST: An opinionated Introduction Backend. First thing first you need to install `rustup`, can be found on https://rustup.rs/
- open terminal and run wsl, run `sudo apt install build-essential # Install pre-reqs`
- done, then `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh`
- it will downloading rust installer, proceed with type 1 to continue. Wait till finish
- verify the instalation by type `source $HOME/.cargo/env` and `rustc --version`. Output will there like rustc `1.70.0 (90c541806 2023-05-31)`
- if hapen not found for `rustc --version`, try to reload the wsl by shutdown command and re-open it up
- create folder for development like `mkdir rust_project` or whatever you like.
- type `cargo new rust_test` and open vscode by `code .`
- hit buton f5 and see recommenda
@4sskick
4sskick / React Native Debug
Last active June 30, 2023 06:46
React Native - Debugging Tools
View React Native Debug
DEBUG-ger react native
---------------------------
use standalone https://github.com/jhen0409/react-native-debugger (rnDebugger)
Mine is use a windows version from release page
- run applicaiton of react native as usual
- open downloaded file of rnDebugger
- open menu developer by type d on terminal or by shaking device
- tap on Debug
- rnDebugger automatically will detect open port for debug
- for first time might be there's error, mine is relate with `invariant-violation-calling-synchronous` bla bla bla~
@4sskick
4sskick / nestjs CLI - new project
Created March 18, 2023 12:44
Nestjs CLI installation generate new project
View nestjs CLI - new project
first time use NestJS and following the documentation. Doc is your friend tbh!
type 'npm i -g @nestjs/cli', done and I got error with some warning.
it said that my npm & angular-devtool version doesn't support and compatible. I don't knwo the detail.
Then I check for latest version lts Node and install it.
I use 'nvm install --lts' wait for done & check using 'nvm ls' it will show you the version of Node version you are using, mine is v18.15.0
re-type 'npm i -g @nestjs/cli' and got no error.
Time to generate new project, type 'nest new <project_name>' and would be asked to which package manager you wanna use, I choose NPM.
Wait till done and finish
View Enable mod_rewrite apache on images docker PHP
I faced a problem when doing some development on Code Igniter project. I have to setup .htaccess to remove index.php from URL. Also face a weird problem when I catch the POST value from form view I created. They aren't delive value of POST data
short lonk story, after I evaluating the whole project's config of framework. Turns out that the culprit is the .htaccess file.
So I need to check the module is already enabled or not on apache. Here the repo project I mean https://github.com/4sskick/infra
Disclaimer:
===========
this only a temporer solution, I believe when I remove the base image of container project, the setup would be back to default.
So you have to re-enable the steps I write here. DYOR !
- make sure you already run the container by docker-compose up -d
@4sskick
4sskick / 'let' + 'const' equivalent in ES5
Created September 4, 2016 20:36
'let' + 'const' equivalent in ES5
View 'let' + 'const' equivalent in ES5
As we knew that 'let & const' are not coming in ES5, those are coming in ES6 since 2015.
So to make these work like in latest version ECMA Scripts 2015, we can define it by ourself.
'const' - ES6
const a = 1;
'const' - ES5
var a = (function(){
var a = 1;
return function(){
@4sskick
4sskick / SQLite migration room db - android
Created March 22, 2022 08:54
short tips on doing migration mobile development using room DB
View SQLite migration room db - android
this process (mgration) is a vital step need to defined very serious.
after setup library room db on android you need to make sure to export schema everytime it changes.
see mine here:
---
build.gradle (app)
---
defaultConfig {
//schema provide for DB room
javaCompileOptions {
annotationProcessorOptions {
View pipenv python - step to activate
These virtual environment seems less informative for me as beginner, compared to virtualenv which I installed [here](https://pythonbasics.org/virtualenv/)
To activate virtual environment, you need to go specific folder project. Then type `pipenv shell`
if there's no virtual env activated yet, output would become `Launching subshell in virtual environment...`
but if there's one activate already, would give an output `Shell for [location project] like C:\Users\monta\.virtualenvs\django-test-LGyddycI already activated`
When that's happen, you need to locate the orject which virtual env point on that location then type `exit`
YES! just type exit. If terminal you use not closed yet. Then virtual env the one activated already would become `deactivate` by doing that
NOW, let's go to basic.
HOW TO CREATE NEW PROJECT USING PIPENV
@4sskick
4sskick / composer php via docker
Created February 18, 2022 09:20
use composer via docker
View composer php via docker
I'm working on project php based (sepc. code igniter 3), which composer gonna be a tools to install dependencies/library. But i don't want to install it on my local.
so I decide to using container as my virtual environment, to do that you can see my Dockerfile on my project here https://github.com/4sskick/infra/blob/master/php-cli/Dockerfile
on the last line, I add command to run curl command to install composer that will attached on my container I'm gonna built after.
to use command composer, you can folllow this command:
- see container ID by command `docker container ls`
- if you use my project infra on my github, it would be using `docker-compose up` to run all services, then see on section ck_php there would be container ID after hit command `docker container ls`
attach the container by command `docker exec -it <container-ID> sh -c "composer --version" `
- it gonna print you the version of composer installed then exit after done
- everytime you need to use composer, you need to hit command `docker exec -
@4sskick
4sskick / rebuilt docker container
Created February 18, 2022 08:46
rebuilding container docker
View rebuilt docker container
this case happen when you already run the exsting container docker, then you gonna edit the config by add another image via `COPY --from=<image-docker> /src /dst` or something else
to get latest version of container you've already edit, you need to rebuit it by command `docker-compose up -d --no-deps --build <service-name-on-docker-compose.yml>`
it gonna recreate container from beginning, based on this `https://stackoverflow.com/questions/36884991/how-to-rebuild-docker-container-in-docker-compose-yml`
@4sskick
4sskick / Transfer repo from X to Y
Last active November 17, 2021 08:37 — forked from mandiwise/Update remote repo
Transfer repo from Bitbucket to Github
View Transfer repo from X to Y
// Reference: http://www.blackdogfoundry.com/blog/moving-repository-from-bitbucket-to-github/
// See also: http://www.paulund.co.uk/change-url-of-git-repository
$ cd to old repo folder
$ git remote rename origin bitbucket
$ git remote add origin https://github.com/account/new-repo.git
$ git push origin master
$ git remote rm bitbucket