Skip to content

Instantly share code, notes, and snippets.

View kwiss's full-sized avatar
👹

christophe kwiss

👹
View GitHub Profile
@kwiss
kwiss / IE 7-8 media queries
Created January 7, 2014 14:21
ie media queries (well that's horrible but sadly seems to work)
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.2/html5shiv.js"></script>
<script src="//s3.amazonaws.com/nwapi/nwmatcher/nwmatcher-1.2.5-min.js"></script>
<script src="//html5base.googlecode.com/svn-history/r38/trunk/js/selectivizr-1.0.3b.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.1.0/respond.min.js"></script>
<![endif]-->
@kwiss
kwiss / weather
Last active August 29, 2015 13:56
<div id='meteo-slides'>
<div class='slides-container'>
<div class='item' data-city='quito'>
<div class='col-xs-10 col-sm-10 col-md-10'>
<h3>Météo en Équateur</h3>
<span class='left'>
<div class='day'>Aujourd'hui</div>
<i></i>
</span>
<span class='conditions'></span>
@kwiss
kwiss / BEM
Last active August 29, 2015 14:16
BEM for us
.blockName{
/* global strate block */
}
.blockName--modifier{
/* global strate block modifier */
}
.blockName-componentName{
/* children component */
-webkit-transition: -webkit-transform .54s cubic-bezier(0.5,0,.1,1) 0s;
-moz-transition: -moz-transform .54s cubic-bezier(0.5,0,.1,1) 0s;
-o-transition: -o-transform .54s cubic-bezier(0.5,0,.1,1) 0s;
transition: transform .54s cubic-bezier(0.5,0,.1,1) 0s;
@kwiss
kwiss / express validator password
Created July 22, 2019 17:16
express validator password
import { check } from 'express-validator/check';
app.post('/testPostPassword', [
check('password')
.exists()
.withMessage('Password should not be empty, minimum eight characters, at least one letter, one number and one special character')
.isLength({ min: 8 })
.withMessage('Password should not be empty, minimum eight characters, at least one letter, one number and one special character')
.matches(/^(?=.*[A-Za-z])(?=.*\d)(?=.*[@$!%*#?&])[A-Za-z\d@$!%*#?&]{8,}$/)
@kwiss
kwiss / useOnClickOutside.js
Created August 18, 2019 11:44
React hook to click outside a ref
// Hook
function useOnClickOutside(ref, handler) {
useEffect(() => {
const listener = event => {
if (!ref.current || ref.current.contains(event.target)) {
return;
}
handler(event);
};
document.addEventListener("mousedown", listener);
@kwiss
kwiss / connect.sh
Created February 29, 2020 12:48
connect digital ocean cluster locally
doctl kubernetes cluster kubeconfig save <cluster>
apiVersion: v1
kind: ServiceAccount
metadata:
name: gitlab-admin
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: gitlab-admin
$ kubectl get -n kube-system secret
NAME TYPE DATA AGE
default-token-2kmsr kubernetes.io/service-account-token 3 3m11s
gitlab-ci-token-jlc58 kubernetes.io/service-account-token 3 118s
# In this case the ServiceAccount token Secret is named `gitlab-ci-token-jlc58`,
# the name of the Secret will differ between clusters (it will always start with `gitlab-ci-token-`)
$ kubectl get -n kube-system secret gitlab-admin-token-jvt8w -o yaml
apiVersion: v1
data:
ca.crt: [REDACATED]
$ kubectl get -n kube-system secret
NAME TYPE DATA AGE
default-token-2kmsr kubernetes.io/service-account-token 3 3m11s
gitlab-ci-token-jlc58 kubernetes.io/service-account-token 3 118s
# In this case the ServiceAccount token Secret is named `gitlab-ci-token-jlc58`,
# the name of the Secret will differ between clusters (it will always start with `gitlab-ci-token-`)
$ kubectl get -n kube-system secret gitlab-admin-token-jvt8w -o yaml
apiVersion: v1
data:
ca.crt: [REDACATED]