Skip to content

Instantly share code, notes, and snippets.

@navix
navix / local-storage.ts
Last active April 11, 2024 09:04
Angular LocalStorage/SessionStorage services. Universal (SSR) compatible.
import { Platform } from '@angular/cdk/platform';
import { Injectable } from '@angular/core';
import { MemoryStorage } from './memory-storage';
@Injectable({
providedIn: 'root',
})
export class LocalStorage implements Storage {
private readonly storage: Storage;
@wohugb
wohugb / index.html
Last active April 5, 2022 02:36 — forked from Globik/index.html
Websocket multi room based on ws.js
<html>
<body>
<h4>websocket</h4>
<h5>Group: <span id="group">darwin</span></h5>
<!-- a hardoced group name -->
<button onclick="bjoin();">join group</button><br />
<input id="text" type="text" />
<span id="out"></span>
<script>
var group = document.getElementById("group").textContent;
@wohugb
wohugb / sample-nginx.conf
Created May 3, 2017 08:19 — forked from cjus/sample-nginx.conf
AngularJS Nginx and html5Mode
server {
server_name yoursite.com;
root /usr/share/html;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
}
@tonyc726
tonyc726 / .npmrc
Last active March 7, 2024 20:48
淘宝镜像加速npm的资源安装升级速度
# 注册模块镜像
registry=https://registry.npmmirror.com
# node-gyp 编译依赖的 node 源码镜像
disturl=https://npmmirror.com/mirrors/node/
# chromedriver
chromedriver_cdnurl=https://cdn.npmmirror.com/binaries/chromedriver/
# operadriver
@nrollr
nrollr / nginx.conf
Last active May 11, 2024 16:31
NGINX config for SSL with Let's Encrypt certs
# UPDATED 17 February 2019
# Redirect all HTTP traffic to HTTPS
server {
listen 80;
listen [::]:80;
server_name www.domain.com domain.com;
return 301 https://$host$request_uri;
}
# SSL configuration
@wohugb
wohugb / main.js
Last active August 4, 2016 07:30
如何在uibModal中使用组件component
'use strict';
(function(){
class MainComponent {
constructor($uibModal,$log){
this.$uibModal = $uibModal;
this.$log = $log;
}
openModal(params){
this.$uibModal.open({
@cjus
cjus / sample-nginx.conf
Last active July 12, 2023 14:59
AngularJS Nginx and html5Mode
server {
server_name yoursite.com;
root /usr/share/html;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
}
@Thinkscape
Thinkscape / application.config.php
Last active December 20, 2015 20:58
Example of production/devel runtime config branching with ZF2 skeleton app.
<?php
// Determine ENV
define('APPLICATION_ENV', getenv('APPLICATION_ENV') == 'development' || PHP_SAPI == 'cli' ? 'development' : 'production');
// Load the appropriate config file
return
APPLICATION_ENV == 'development' ?
require __DIR__.'/application.development.config.php' :
require __DIR__.'/application.production.config.php'
;
@cloudsben
cloudsben / md-menu.html
Last active June 14, 2023 07:46
markdown menu
<link rel="stylesheet" href="http://yandex.st/highlightjs/6.2/styles/googlecode.min.css">
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script src="http://yandex.st/highlightjs/6.2/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<script type="text/javascript">
$(document).ready(function(){
$("h2,h3,h4,h5,h6").each(function(i,item){
var tag = $(item).get(0).localName;
@jaredhanson
jaredhanson / gist:2559730
Created April 30, 2012 16:20
Restify and Passport /cc Hal Robertson
// Based off example code from Hal Robertson
// https://github.com/halrobertson/test-restify-passport-facebook
// See discussion: https://groups.google.com/forum/?fromgroups#!topic/passportjs/zCz0nXB_gao
var restify = require('restify')
// config vars
var FB_LOGIN_PATH = '/api/facebook_login'
var FB_CALLBACK_PATH = '/api/facebook_callback'
var FB_APPID = '<<YOUR APPID HERE>>'