Skip to content

Instantly share code, notes, and snippets.

View martinyung's full-sized avatar

Martin martinyung

View GitHub Profile
@martinyung
martinyung / index.html
Last active June 25, 2017 07:28
conversational-form with react.js - add CDN
<head>
...
<script type="text/javascript" src="https://cf-4053.kxcdn.com/conversational-form/0.9.4/conversational-form.min.js" crossorigin></script>
</head>
@martinyung
martinyung / hello.jsx
Last active June 25, 2017 07:39
conversational-form with react.js - cf setup reference
class Hello extends Component {
constructor(props) {
super(props):
this.cf = null; // <-- Conversational Form ref
}
...
}
export default Hello;
@martinyung
martinyung / hello.jsx
Last active June 25, 2017 08:07
conversational-form with react.js - add cf info
class Hello extends Component {
...
componentDidMount(){
// customize your questions here
this.refs.name.setAttribute('cf-questions', "What is your name?");
this.refs.email.setAttribute('cf-questions', "What is your email?");
this.refs.description.setAttribute('cf-questions', "Describe your requirement");
this.cf = window.cf.ConversationalForm.startTheConversation({
@martinyung
martinyung / hello.jsx
Last active June 25, 2017 08:07
conversational-form with react.js - render()
class Hello extends Component {
...
render() {
return (
<div>
<h2>Conversational Form</h2>
<div id="cf-context" > {/* <-- the cf form will be bound to this element */}
<form id="form" className="form" ref="form">
<input type="text" ref="name" placeholder="Name" defaultValue={this.props.name}/>
@martinyung
martinyung / Upload.vue
Created September 9, 2017 05:04
[blogging purpose] file upload vuejs component - template
<!-- HTML Template -->
<template>
<div>
<div class="input-group">
<input type="text" class="form-control" placeholder="Select file..." :value="file.name" readonly>
<span class="input-group-btn">
<button class="btn btn-default" type="button" @click="selectFile">Select file</button>
<button class="btn btn-default" type="button" @click="uploadFile">Upload</button>
</span>
</div>
@martinyung
martinyung / Upload.vue
Last active September 9, 2017 05:28
[blogging purpose] file upload vuejs component - js
<script>
const BASE_URL = "[YOUR_PROJECT_URL]"
export default {
name: 'FileUpload',
directives: {
uploader: {
bind (el, binding, vnode) {
el.addEventListener('change', e => {
@martinyung
martinyung / UploadController.groovy
Last active September 9, 2017 05:41
[blogging purpose] grails upload controller
package [Your_Project]
class UploadController {
def amazonS3Service
def s3Bucket = 'Your_S3_Bucket_Name'
def index() {
def uploadedFile = request.getFile('file')

Keybase proof

I hereby claim:

  • I am martinyung on github.
  • I am m4rt1nk (https://keybase.io/m4rt1nk) on keybase.
  • I have a public key ASCLKU6hw67b1T8swA9xcKSZerz1Ynk86lH1xT2TftchrAo

To claim this, I am signing this object:

@martinyung
martinyung / main.py
Last active January 29, 2022 14:10
python etl
def main():
print('starting etl')
# establish connection for target database (sql-server)
target_cnx = pyodbc.connect(**datawarehouse_db_config)
# loop through credentials
# mysql
for config in mysql_db_config:
@martinyung
martinyung / sql_queries.py
Last active January 29, 2022 14:11
python etl
# example queries, will be different across different db platform
firebird_extract = ('''
SELECT fbd_column_1, fbd_column_2, fbd_column_3
FROM fbd_table;
''')
firebird_insert = ('''
INSERT INTO table (column_1, column_2, column_3)
VALUES (?, ?, ?)
''')