Skip to content

Instantly share code, notes, and snippets.

View chiwent's full-sized avatar
:octocat:
Focusing

chiwent

:octocat:
Focusing
View GitHub Profile
@y0ngb1n
y0ngb1n / docker-registry-mirrors.md
Last active April 19, 2025 05:12
国内的 Docker Hub 镜像加速器,由国内教育机构与各大云服务商提供的镜像加速服务 | Dockerized 实践 https://github.com/y0ngb1n/dockerized
@jedfoster
jedfoster / Koala.jpg
Last active May 8, 2019 03:14 — forked from uolcano/Koala.jpg
Be into the Gist
Koala.jpg
@overtrue
overtrue / _utils.scss
Last active March 2, 2019 17:16
scss utils.
// Mobile project scss utils.
// https://gist.github.com/overtrue/56561fd4b124b9ffe5048ef06752d4bf
// Space
//
$spacer: 12px !default;
@each $prop, $abbrev in (margin: m, padding: p) {
@for $size from 0 to 10 {
$value: #{$size * $spacer};
@shashankduhan
shashankduhan / router.js
Created January 2, 2017 01:22
A simple Hash Router for javascript
//Shashank Duhan 2017 | CC.0
//You gonna need reflex.js for this :
// https://gist.github.com/shashankduhan/673a4e1223afe550ca69958bcb73181c
window.router = (()=>{
"use strict"
return {
state: 0,
init: function(user){
router.routes = router.state;
window.addEventListener("hashchange", router.router);
@Saul-Mirone
Saul-Mirone / mini-express.js
Last active November 15, 2019 12:36
Just An Express Style Framework
const http = require('http')
const url = require('url')
const path = require('path')
const fs = require('fs')
const mime = {
"html": "text/html",
"css": "text/css",
"js": "text/javascript",
"json": "application/json",
"gif": "image/gif",
@yangfch3
yangfch3 / ajax.js
Last active March 23, 2020 07:06
ajax 请求封装
var Ajax = (function() {
var methodsList = ['get', 'post', 'head', 'options', 'put', 'connect', 'trace', 'delete'];
/**
* Ajax
* @param {String} url
* @param {Function} callback
* @param {Object/String} data
* @param {Object} options
*
@jaredpalmer
jaredpalmer / tweet.js
Created April 6, 2016 22:45
send-tweet.js
/*
* Code snippet for posting tweets to your own twitter account from node.js.
* You must first create an app through twitter, grab the apps key/secret,
* and generate your access token/secret (should be same page that you get the
* app key/secret).
* Uses oauth package found below:
* https://github.com/ciaranj/node-oauth
* npm install oauth
* For additional usage beyond status updates, refer to twitter api
* https://dev.twitter.com/docs/api/1.1
@yoavweiss
yoavweiss / domtokenlist_feature_detection.js
Last active January 10, 2020 17:36
DOMTokenList supports() example
var DOMTokenListSupports = function(tokenList, token) {
if (!tokenList || !tokenList.supports) {
return;
}
try {
return tokenList.supports(token);
} catch (e) {
if (e instanceof TypeError) {
console.log("The DOMTokenList doesn't have a supported tokens list");
} else {
@EtienneR
EtienneR / user.js
Created January 7, 2016 23:39
XMLHttpRequest RESTful (GET, POST, PUT, DELETE)
// Get all users
var url = "http://localhost:8080/api/v1/users";
var xhr = new XMLHttpRequest()
xhr.open('GET', url, true)
xhr.onload = function () {
var users = JSON.parse(xhr.responseText);
if (xhr.readyState == 4 && xhr.status == "200") {
console.table(users);
} else {
console.error(users);
@datchley
datchley / es6-eventemitter.js
Last active June 7, 2021 03:40
A straight forward EventEmitter implemented in Javascript using ES6
let isFunction = function(obj) {
return typeof obj == 'function' || false;
};
class EventEmitter {
constructor() {
this.listeners = new Map();
}
addListener(label, callback) {
this.listeners.has(label) || this.listeners.set(label, []);