- Sharing what has worked for me in different React Native projects
- Reusing screens in different parts of your app
- Easy to work separately in a feature
- Add an extra level (nested folder) only when necessary
- Don't overuse
index.jsfor everything
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
| module.exports = { | |
| googleClientID: "YOUR_GOOGLE_CLIENT_ID", | |
| googleClientSecret: "YOUR_CLIENT_SECRET" | |
| } |
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
| #!/home/umar/.nvm/versions/node/v8.11.3/bin/node | |
| let fs = require("fs"); | |
| let text = fs.readFileSync("text.txt", "utf-8"); | |
| text.split("\n").forEach(function(line) { | |
| let reverse = line.split("").reverse().join("") | |
| if (line.toLowerCase() === reverse) { | |
| console.log("Detected palindrome at:", line); | |
| } |
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
| # Extract many files with one command | |
| function extract () { | |
| if [ -f $1 ] ; then | |
| case $1 in | |
| *.tar.bz2) tar xvjf $1 ;; | |
| *.tar.gz) tar xvzf $1 ;; | |
| *.tar.xz) tar Jxvf $1 ;; | |
| *.bz2) bunzip2 $1 ;; | |
| *.rar) rar x $1 ;; | |
| *.gz) gunzip $1 ;; |
ffmpeg -i tmp/audio-notes.m4a -acodec libmp3lame -aq 9 tmp/audio-notes.mp3
for file in *.m4a ; do ffmpeg -i $file -acodec libmp3lame -aq 9 ${file%.m4a}.mp3 ; done
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 <stdio.h> | |
| #include <stdlib.h> | |
| #include <pthread.h> | |
| // Compile : $ clang add.c -lpthread -w -o add | |
| // atau $ gcc add.c -lpthread -w -o add | |
| // https://stackoverflow.com/questions/24947446/pthread-create-how-do-i-get-the-returned-value-from-the-passed-function | |
| #define TOTAL_CPU 8 | |
| #define LOOP_MAX 800000000 // LOOP_MAX nilainya sebesar memory fisik yang tersedia, jika terlalu besar akan segfault | |
| #define LOOP_THREAD LOOP_MAX/TOTAL_CPU |
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
| WifiManager wifiManager = (WifiManager) getSystemService(WIFI_SERVICE); | |
| WifiInfo wifiInfo = wifiManager.getConnectionInfo(); | |
| int ipAddress = wifiInfo.getIpAddress(); | |
| String ipString = String.format("%d.%d.%d.%d", (ip & 0xff), (ip >> 8 & 0xff), (ip >> 16 & 0xff), (ip >> 24 & 0xff)); |
System: Debian/Ubuntu/Fedora. Might work for others as well.
As mentioned here, to update a go version you will first need to uninstall the original version.
To uninstall, delete the /usr/local/go directory by:
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
| package main | |
| import ( | |
| "fmt" | |
| "encoding/json" | |
| ) | |
| var b = []byte(`{ | |
| "Module": [ | |
| { |
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 <stdio.h> | |
| #include <pthread.h> | |
| #include <unistd.h> | |
| // unmark pthread_detach(), memory leak will be gone | |
| void* process( void* data ) { | |
| printf( "hello world\n" ); | |
| } | |
| main() { |