- People talk about two servers: a web server (e.g. Nginx, Apache, etc.) and a app server (e.g. Language specific servers like Unicorn, Node.js, Tomcat, Http-Kit, etc.). There are exceptions where app servers not required at all (as web server itself provides preprocessors for handling), but let's not talk about now.
- Web servers are really fast and supports lot of standard and commonly used MIME-type requests. Concept of serving a file is -- forming and sending a response of bytes of data and labeling it with requested MIME-type by a client (e.g. web browser).
- Every response format (in layman's language, a file) is recognized by it's MIME-type, for e.g. a PNG image file has "image/png" MIME-type. JavaScript file has "text/javascript". HTML responses (or files) has "text/html". Plain text files have "text/plain".
- Modern Browsers supports a lot of standard MIME-types. Images, videos, text files (XML, HTML, SVG, JS), and they better know how to visualize it. Browser also knows unrec
This file contains hidden or 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
| // only works if app has a launcher activity | |
| Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.example.yourapp"); | |
| startActivity(launchIntent); | |
| // works if we know the name of the main activity, even if not a launcher | |
| Intent intent = new Intent(Intent.ACTION_MAIN); | |
| intent.setClassName("com.example.yourapp", "com.example.yourapp.MainActivity"); | |
| startActivity(intent); |
This file contains hidden or 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 "Car.h" | |
| const int ACCELERATION_FACTOR = 10; | |
| const int BRAKING_FACTOR = 30; | |
| Car::Car() { | |
| speed = 0; | |
| } | |
| void Car::accelerate(float intensity) { |
This file contains hidden or 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> | |
| // Cool way to render Vue components from HTML Strings | |
| // https://medium.com/haiiro-io/compile-markdown-as-vue-template-on-nuxt-js-1c606c15731c | |
| import VueWithCompiler from "vue/dist/vue.esm"; | |
| export default { | |
| props: { | |
| html: { | |
| type: String, | |
| default: "", | |
| }, |
This file contains hidden or 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
| # -- consts -- | |
| ECHARTS_CDN = "https://cdn.jsdelivr.net/npm/echarts@5.3.2/dist/echarts.min" | |
| ECHARTS_REQUIREJS_CONF = f"requirejs.config({{paths: {{echarts: '{ECHARTS_CDN}',}}}});" | |
| ECHARTS_TEMPLATE = f""" | |
| <div id="{{ID}}" style="width: {{WIDTH}};height:{{HEIGHT}};"></div> | |
| <script type="module"> | |
| {ECHARTS_REQUIREJS_CONF} | |
| requirejs(["echarts"], (echarts) => {{ | |
| let myChart = echarts.init(document.getElementById({{ID}})); |
This file contains hidden or 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
| adb connect 192.168.0.55 | |
| adb shell /system/bin/screencap -p /sdcard/screenshot.png | |
| adb pull /sdcard/screenshot.png C:/Users/xxxx/Downloads/screenshot.png | |
| @echo off | |
| for /F "tokens=2" %%i in ('date /t') do set mydate=%%i | |
| set mytime=%time% |
This file contains hidden or 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
| #!/bin/bash | |
| # put this script in directory | |
| # D:\laragon\bin\git\usr\bin | |
| # then gpa.sh will be available in git bash | |
| # git push to all remote | |
| remotes=( $(git remote) ) | |
| # coding |
In my project folder I have 2 folders client and server, I only want get the changes in my server folder from master to prod branch
git checkout prod- Go to the branch with the oldest changesgit merge --no-commit --no-ff master- Merge with the branch with the latest changes. Read Moregit reset -- client*- Unstage any changes from client folder, I only want to server folder. Read Moregit checkout -- client*- Remove any changes from client folder, I only want to server folder.git clean -n- View all unstaged files. Read Moregit clean -fd- Remove all unstaged folder, if you dont want to remove all then you should add those withgit addand then run this command. Read More
This file contains hidden or 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
| #include <iostream> | |
| #include <sys/types.h> | |
| #include <unistd.h> | |
| #include <sys/socket.h> | |
| #include <netdb.h> | |
| #include <arpa/inet.h> | |
| #include <string.h> | |
| #include <string> | |
| using namespace std; |
This file contains hidden or 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
| #include <iostream> | |
| #include <sys/types.h> | |
| #include <unistd.h> | |
| #include <sys/socket.h> | |
| #include <netdb.h> | |
| #include <arpa/inet.h> | |
| #include <string.h> | |
| #include <string> | |
| using namespace std; |
NewerOlder