Skip to content

Instantly share code, notes, and snippets.

View railsgem's full-sized avatar
🎯
Focusing

Ying Chen railsgem

🎯
Focusing
View GitHub Profile
@railsgem
railsgem / php-interview.md
Created May 8, 2019 11:59 — forked from messified/php-interview.md
PHP Engineer Interview: What you should know

PHP Developer Interview: What you should know

###1. What’s the difference between " self " and " this " ?

Use $this to refer to the current object. Use self to refer to the current class. In other words, use $this->member for non-static members, use self::$member for static members.

Source: When to use self vs this -stackoverflow

@railsgem
railsgem / flutter_listview_pagination.dart
Last active April 25, 2019 08:32
flutter listview pagination
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
@railsgem
railsgem / http_json_listview.dart
Created April 22, 2019 10:36
http get json with listview
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:http/http.dart' as http;
import 'dart:convert';
import 'package:cached_network_image/cached_network_image.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@railsgem
railsgem / getAPIJson.dart
Created April 22, 2019 10:29
GET JSON DATA DART
// Function to get the JSON data
Future<String> getJSONData() async {
var response = await http.get(
// Encode the url
Uri.encodeFull("https://unsplash.com/napi/photos/Q14J2k8VE3U/related"),
// Only accept JSON response
headers: {"Accept": "application/json"}
);
@railsgem
railsgem / image-data.json
Last active April 22, 2019 10:28
json-example
{
"total":20,
"results":[
{
"id":"hzgs56Ze49s",
"created_at":"2015-04-25T07:52:00-04:00",
"updated_at":"2019-04-21T19:55:18-04:00",
"width":5616,
"height":3744,
"color":"#876B59",
@railsgem
railsgem / pubspec.yaml
Created April 22, 2019 10:00
Flutter Tutorial Part 4: Http Fetch data and parse JSON with ListView
name: flutter_http
description: A new Flutter project.
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
@railsgem
railsgem / JsonConvert.java
Created September 26, 2018 09:56
JsonConvert
package com.naamtech.util;
import java.io.StringReader;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import org.json.simple.JSONObject;
import org.json.simple.JSONArray;
import org.json.simple.JSONValue;
import java.lang.Object.*;
public class JsonConvert {
@railsgem
railsgem / dqn_mountaincar.py
Created October 22, 2017 12:28 — forked from floodsung/dqn_mountaincar.py
DQN for MountainCar
# -------------------------------
# DQN for CartPole in OpenAI Gym
# Author: Flood Sung
# Date: 2016.6.27
# All rights reserved
# -------------------------------
import gym
import tensorflow as tf
import numpy as np
@railsgem
railsgem / dqn.py
Created October 19, 2017 04:47 — forked from floodsung/dqn.py
DQN
# -------------------------------
# DQN for CartPole in OpenAI Gym
# Author: Flood Sung
# Date: 2016.6.27
# All rights reserved
# -------------------------------
import gym
import tensorflow as tf
import numpy as np
@railsgem
railsgem / soft_jaccard.py
Created October 17, 2017 04:03 — forked from mhluongo/soft_jaccard.py
An implementation of a "soft Jaccard" set similarity measure
>>> import jellyfish
>>> from soft_jaccard import soft_jaccard
>>> c1 = set(['CL Isbell','C. L. Isbell'])
>>> c2 = set(['C Isbell','C Isbell, Jr.'])
>>> soft_jaccard(c1, c2, jellyfish.jaro_winkler)
0.75848950260673509