Skip to content

Instantly share code, notes, and snippets.

View shellphon's full-sized avatar
💌

Dont Wong shellphon

💌
View GitHub Profile
@shellphon
shellphon / example.component.ts
Created April 27, 2018 03:29 — forked from gilhanan/example.component.ts
Example on how to achieve RxJS observable caching and storage in Angular 2+. Ideal for storing Http requests client side for offline usage.
import { Component, OnInit, OnDestroy } from '@angular/core';
import {Http} from "@angular/http";
import { LocalCacheService } from "./local-cache.service";
@Component({
selector: 'app-example',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class ExampleComponent implements OnInit, OnDestroy {
@shellphon
shellphon / gist:92b59aa1e4d72f0633cd
Created December 15, 2014 15:54
node-my-tool-html2jsp
/*
API:
获取参数 process.argv
运行nodejs时,node xxx.js yyy
argv[0] : node
argv[1] : xxx.js //当前脚本名
argv[2] : yyy //文件名,不包含后缀
……
读取文件 fs readFileSync 该方法会返回一个流对象,通过toString()可以转换为字符串
*/
@shellphon
shellphon / wxSharejs
Created November 25, 2014 09:53
wxShare.js
var wxShare = function(imgUrl, lineLink, descContent, shareTitle, appid){
function shareFriend() {
WeixinJSBridge.invoke('sendAppMessage',{
"appid": appid,
"img_url": imgUrl,
"img_width": "200",
"img_height": "200",
"link": lineLink,
"desc": descContent,
@shellphon
shellphon / getAlbumPicsBypy3
Created January 11, 2014 02:35
get pictures from douban albums by python3
#need beautifulsoup for parse the html text
#python
#
#获取相册页面,分析获取分页的url
#根据抓取的url分别做处理:将url页面中的真实图片名称获取
#将上一步的名称替换到指定的图片地址格式中,开始下载图片
#
import re
import os
import urllib.request