Skip to content

Instantly share code, notes, and snippets.

View cakcak27's full-sized avatar
🌴
On vacation

Ikbal Chahyadi cakcak27

🌴
On vacation
View GitHub Profile
//Bentuk ke satu pakai map
<View>
{
[0,1,2,3,4,5,6,7,8,9].map(
(item,key)=>(<Text key={key}>{item}</Text>)
)
}
</View>
// Bentuk ke dua pakai operator looping for di dalam render
// Memparse array ke bentuk array lain
render(){
let bentukSatu=[
{id:'1', nama:'AA',alamat:'alamat1'},
{id:'2', nama:'DD',alamat:'alamat2'},
{id:'3', nama:'CC',alamat:'alamat3'}
]
let bentukDua=[] // misalnya kita ingin mengubah field object (id, nama, alamat) menjadi field (userId,userNama,userAlamat)
let itemBentukDua={}
@cakcak27
cakcak27 / PickerDemo.jsx
Last active April 30, 2019 15:06
MinimizePickerOption
import React, { Component } from 'react';
import {View,Text,Picker} from 'react-native';
export default class PickerDemo extends Component {
state={
quality:'',
size:''
}
getValueFromPicker=(val)=>{
const testModule=(()=>{
var aLocal=''
function setA(a){
aLocal=a
}
return{
a:function(){return aLocal},
setA
}
})(testModule)
@cakcak27
cakcak27 / TokenComponent.jsx
Last active May 8, 2019 03:54
ngejalanin token
import React, {Component} from 'react';
import { Text, View } from 'react-native';
//api.localTokenKey require
class TokenComponent extends Component {
state={
tokens:{}
}
loadAsyncStorage=()=>{
@cakcak27
cakcak27 / PickerModal.jsx
Last active May 12, 2019 19:35
PickerModal
export default class PickerModal extends Component {
state={
loading:false,
option:[],
selectedItem:{},
selected:false,
modalVisible:false,
}
loadOptions=()=>{
class Spesification extends Component {
state = {
value:''
}
render(){
const{ data, caption , sendItem, name, initialProp } = this.props
const initial=initialProp?initialProp:"Pilih Option"
return(
@cakcak27
cakcak27 / sample_convertprojection.js
Last active October 8, 2021 17:03
Menconversi Projection ke Epsg:23835
import Map from 'ol/Map';
import View from 'ol/View';
import OSM from 'ol/source/OSM';
import TileLayer from 'ol/layer/Tile';
import {fromLonLat} from 'ol/proj';
import Point from 'ol/geom/Point';
import LineString from 'ol/geom/LineString';
import MultiLineString from 'ol/geom/MultiLineString';
import {Fill, Stroke, Circle, Style} from 'ol/style';
@cakcak27
cakcak27 / create_kernel_jupiter_notebook.md
Created May 21, 2024 03:55
How to create kernel for jupyter notebook

Prerequisites

Before getting started, you should have the following tools installed on your system:

  1. Python 3.x (preferably the latest version)
  2. Jupyter Notebook
  3. virtualenv (for creating virtual environments) If you don’t have these installed, follow the instructions on their respective websites to get them set up.

Step 1: Create a Python 3 Virtual Environment

First, we need to create a new virtual environment for our Python 3 kernel. This will help us manage the dependencies and packages used by the kernel independently from the system-wide Python installation.