Skip to content

Instantly share code, notes, and snippets.

/*
* example: @include background@2x( 'path/to/image', 'png', repeat-x);
*/
@mixin background_2x($path, $ext: "png", $repeat: no-repeat) {
$at1x_path: "#{$path}.#{$ext}";
$at2x_path: "#{$path}@2x.#{$ext}";
background-image: url("#{$at1x_path}");
background-repeat: $repeat;
from bs4 import BeautifulSoup
import requests
import requests_cache
requests_cache.install_cache('nobel_pages', backend='sqlite', expire_after=7200)
BASE_URL = 'http://en.wikipedia.org'
HEADERS = {'User-Agent': 'Mozilla/5.0'}
var gulp = require('gulp');
var watch = require('gulp-watch');
var webpackStream = require('webpack-stream');
var batch = require('gulp-batch');
var compass = require('gulp-compass');
var plumber = require('gulp-plumber');
var clean = require('gulp-clean');
var webpackConfig = require('./webpack.config.js');
var browserSync = require('browser-sync');
var path = require('path');
var webpack = require('webpack');
module.exports = {
// if you need browsery sync, you should set it to be true.
watch: true,
entry: {
vendor: [
'./resources/assets/js/vendors/jquery.min.js',
'./resources/assets/js/vendors/bootstrap.min.js',
@winwu
winwu / us_font.css
Created November 30, 2016 08:58
css font import example
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 100;
src: local('Roboto Thin'), local('Roboto-Thin'),
url(fonts/Roboto-Thin.ttf) format('truetype');
}
@font-face {
font-family: 'Roboto';
font-style: normal;
var Company = function (config) {
this.name = config.name;
this.fbFansUrl = config.fbFansUrl;
};
Company.prototype.getName = function () {
return this.name;
};
Company.prototype.getFbFansPage = function () {
return this.fbFansUrl;
};
/* interfeace 定義對象內部結構 也可以用來約束 class 的行為*/
interface Employee {
jobTitle: string,
years?: number
};
// 此 function 接受 Employee 型別的變數 e
function getEmployeeBasicSalary(e: Employee) {
// 可能的底薪,亂 key 的 只是示範 XD
let basicSalary = e.years * 2;
/*
* TypeScript 可以使用 ES6 的 class 語法
* 但 TypeScript 還可以額外使用靜態型別的那種修飾字:
* 如 public, protected, private
*/
class Employee {
// name is public!
public name: string;
// manager is private, cannot be access from outside
// boolean 布林
var isUserExists = false;
// Number 數值
var myAge = 26;
// String 字串
var jobTitle = 'Frontend Engineer';
// String 也可以用 字串樣板 (Template Literals) ${ expr }
// boolean 布林
let isUserExists: boolean = false;
// Number 數值
let myAge: number = 26;
// String 字串
let jobTitle: string = 'Frontend Engineer';
// String 也可以用 字串樣板 (Template Literals) ${ expr }