Skip to content

Instantly share code, notes, and snippets.

View dreamline2's full-sized avatar
🎯
Focusing

Wilson dreamline2

🎯
Focusing
View GitHub Profile
asdfasfasd
@dreamline2
dreamline2 / crawler.py
Created February 18, 2020 06:48
Crawler for facebook group posts.
import selenium
from selenium import webdriver
from bs4 import BeautifulSoup
import numpy as np
import time
import csv
chrome_options = webdriver.ChromeOptions()
prefs = {"profile.default_content_setting_values.notifications" : 2}
chrome_options.add_experimental_option("prefs",prefs)
@dreamline2
dreamline2 / hello.js
Created November 26, 2019 05:53
title
console.log('hello world')
@dreamline2
dreamline2 / basic_calculator.js
Created January 15, 2018 09:30
ezprice_interview_question
//https://leetcode.com/problems/basic-calculator/description/
var calculate = function(s) {
var positiveArr = s.replace(/\s|\(|\)|\-\d{1}/g,"").split(/\+/);
var positiveNum = positiveArr.reduce( (x,y) => parseInt(x) + parseInt(y) );
var hasNegative = s.replace(/\s|\(|\)/g,"").replace(/^\d{1}|\+\d{1}/g, "");
var negativeNum, negativeArr;
if (hasNegative) {
negativeArr = hasNegative.split(/\-/).filter(x=>x);
@dreamline2
dreamline2 / answer1.js
Last active December 22, 2017 11:33
Oursky Pre-Test
function isSubset(wrap, sub) {
var result = true;
sub.map(function(letter){
if (wrap.indexOf(letter) == -1) { result = false; }
});
return result;
}
@dreamline2
dreamline2 / dynamic_facebook_comment.html
Last active June 17, 2016 06:48
dynamic facebook comment
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({
appId : {{yourFacebookId}},
xfbml : true,
version : 'v2.6'
});
checker = setInterval(function(){
if (!document.querySelector(".fb-comments iframe")) {
spinner.setAttribute("class", "show");
@dreamline2
dreamline2 / operate.js
Last active September 16, 2015 04:56
singleton example -> create plus and minus to operate num
var operate = (function(){
// num is local variable, and we can via return api to manipulate num, no other external methods to manipulate num.
var num;
function createNum() {
var num = new Number(0);
return num;
}
@dreamline2
dreamline2 / 舊版GA嵌入碼.html
Last active August 29, 2015 14:22
轉換事件嵌入碼
<script type="text/javascript">
var TCGA = TCGA || {};
TCGA.cthouseProductId = $(".c5").text().match(/\d*/g).join("");
TCGA.cthouseProductName = $(".c5").text().split(/\(/)[0];
TCGA.time = new Date();
TCGA.timeStamp = TCGA.time.getFullYear() + '/' + (TCGA.time.getMonth() + 1) + '/' + TCGA.time.getDate() + '::' + (TCGA.time.getHours());
var _gaq = _gaq || [];
@dreamline2
dreamline2 / main.jsx
Created May 14, 2015 05:10
server.js
'use strict';
/* Initialize Locales */
l20n.initializeLocales('demo', {
'locales': ['en-US', 'fr', 'it', 'ge', 'ar', 'ch'],
'default': 'en-US'
});
/* Initializing touch events */
React.initializeTouchEvents(true);