Skip to content

Instantly share code, notes, and snippets.

View dashengz's full-sized avatar

Dasheng Jonathan Zhang dashengz

  • Teachers College
  • New York, NY
View GitHub Profile
@dashengz
dashengz / product-configurators-3.js
Last active May 19, 2020 17:37
Corvid by Wix: Product Configurators - Initialize Configurators
// Step 3 (Final Step): Initialize configurators after $w is ready
$w.onReady(function () {
// referencing the _options and _databases in Step 1
new ProductConfigurators(_options, _databases);
});
// All set!
@dashengz
dashengz / product-configurators-2.js
Last active May 19, 2020 17:23
Corvid by Wix: Product Configurators - ProductConfigurators class
// Step 2: Add in ProductConfigurators class
class ProductConfigurators {
constructor (options, databases) {
this.options = options.map(v => {
return {
...v,
overlay: $w(v.overlay),
title: $w(v.title),
repeater: $w(v.repeater)
@dashengz
dashengz / product-configurators-1.js
Last active May 19, 2020 17:23
Corvid by Wix: Product Configurators - Parameters
// Step 1: Specify the IDs of the components on your dynamic product page
const _options = [
// Three sets of options
{
overlay: '#image2',
title: '#text14',
repeater: '#repeater1',
button: '#button1',
buttonImage: '#image5'
@dashengz
dashengz / product-configurators.js
Last active May 19, 2020 17:22
Corvid by Wix: Product Configurators
// Step 1: Specify the IDs of the components on your dynamic product page
const _options = [
// Three sets of options
{
overlay: '#image2',
title: '#text14',
repeater: '#repeater1',
button: '#button1',
buttonImage: '#image5'
@dashengz
dashengz / rss_to_json.py
Created April 1, 2019 21:29
Convert Exported Wordpress RSS data to JSON
import xml.etree.ElementTree as ET
import json
# configuration: change filename and namespace if needed
xml_name = './data.xml'
out_name = r'data.json'
ns = {
'wp': 'http://wordpress.org/export/1.2/',
'excerpt': 'http://wordpress.org/export/1.2/excerpt/',
@dashengz
dashengz / MainActivity.java
Last active January 27, 2017 02:58
Starting code for the Coffee Ordering App's MainActivity.java
package your.package.name;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
// Global variable for quantity
...