Skip to content

Instantly share code, notes, and snippets.

View hprobotic's full-sized avatar
🌴
On vacation

John Pham hprobotic

🌴
On vacation
View GitHub Profile
/*! reset.css v2.0 | MIT License | git.io/normalize */
/* ==========================================================================
HTML5 display definitions
========================================================================== */
/**
* Correct `block` display not defined in IE 8/9.
*/
article, aside, details, figcaption, figure, footer, header, hgroup, main, nav, section, summary {
@hprobotic
hprobotic / rdrc2016.md
Created June 26, 2016 15:19 — forked from cheeaun/rdrc2016.md
RedDotRubyConf 2016 links & resources 😘
//
// APIRouter.swift
// PicPic
//
// Created by Johnny Pham on 6/20/16.
// Copyright © 2016 John Pham. All rights reserved.
//
import Foundation
import Alamofire
//
// UIImageExtension.swift
// PicPic
//
// Created by Johnny Pham on 6/28/16.
// Copyright © 2016 John Pham. All rights reserved.
//
import UIKit
#!/usr/bin/env babel-node
require('./helper')
let fs = require('fs').promise
let express = require('express')
let PromiseRouter = require('express-promise-router')
let morgan = require('morgan')
let trycatch = require('trycatch')
let bodyParser = require('body-parser')
//
// SLBKAPIRouter.swift
// SolarBK
//
// Created by JohnP on 11/1/16.
// Copyright © 2016 JohnP. All rights reserved.
//
import Foundation
import Alamofire
// raw
Alamofire.request(.GET, "http://api.room2shop.com/api/product/GetProducts?categoryId=22&filter=2&pageNumber=1")
.responseJSON { response in
debugPrint(response)
switch response.result {
case .Success(let JSON):
print(JSON)
case .Failure(let error):
print(error)
func checkGuarantee() -> Promise<JSON> {
return Promise { fulfill, reject in
for index in 1...3 {
let typeOfId = index
let parameters = [
"u": "solarbkgo",
"p": "c8453f377e716b46ca29b321a20767c4",
"type": typeOfId,
"code": "33252"
] as [String : Any]
private void InitLineChartView() {
lineChartView.setDescription("Công suất PV trong ngày");
YAxis axisLeft = lineChartView.getAxisLeft();
axisLeft.setEnabled(false);
YAxis axisRight = lineChartView.getAxisRight();
axisRight.setDrawAxisLine(false);
AxisValueFormatter rightAxisValueFormatter = new AxisValueFormatter() {
@Override
public String getFormattedValue(float value, AxisBase axis) {
return (int)value + " W";
private void setupChartData(LineData lineData) {
LineDataSet collectorSet = (LineDataSet) lineData.getDataSetByIndex(0);
if (collectorSet == null) {
setupChart();
return;
}
collectorSet.setDrawFilled(true);
collectorSet.setMode(LineDataSet.Mode.CUBIC_BEZIER);
collectorSet.setFillColor(ContextCompat.getColor(getContext(), R.color.solarBkPrimary));
collectorSet.setDrawValues(false);