Skip to content

Instantly share code, notes, and snippets.

Avatar
🧗
On the rock

Yoann Cribier akabab

🧗
On the rock
View GitHub Profile
@akabab
akabab / donbass.md
Last active March 8, 2022 06:06
Pour une actualité et une information pertinente..
View donbass.md

Pour une actualité et une information pertinente..

il faut voir / lire / écouter tout les partis
prendre du recul
surtout vérifier ses sources
se faire son avis

Voila ce qu’on ne montre pas ou trop peu

Anne-Laure BONNEL

View snake.js
// HELPERS
const print = s => process.stdout.write(s)
const Array2d = (rows, cols, fill = 0) => Array(rows).fill(0).map(_ => Array(cols).fill(fill))
// const wait = ms => new Promise(_ => setTimeout(_, ms))
const Game = require('./Game.js')
View gist:da297cd038c337d90398d2bedf3e2b2e
# install postgres
brew install postgresql
# set service to restart postgres on startup
pg_ctl -D /usr/local/var/postgres start && brew services start postgresql
View problem1.js
const openingHours = {
monday: [
{ begin: '10:00', end: '12:00' },
{ begin: '13:00', end: '18:00' },
],
tuesday: [
{ begin: '10:00', end: '12:00' },
{ begin: '13:00', end: '18:00' },
],
wednesday: [
@akabab
akabab / App.js
Last active June 18, 2018 10:03
Redux exemple
View App.js
import React, { Component } from 'react'
import store from './store.js'
class App extends Component {
componentDidMount() {
// subscribe to changes -> forceUpdate will ask React to re-render the view
this.unsubscribe = store.subscribe(() => this.forceUpdate())
}
@akabab
akabab / App.js
Last active June 18, 2018 10:08
Redux setup
View App.js
import React, { Component } from 'react'
import store from './store.js'
class App extends Component {
componentDidMount() {
// subscribe to state changes -> forceUpdate will ask React to re-render the view
this.unsubscribe = store.subscribe(() => this.forceUpdate())
}
@akabab
akabab / rm_mysql.md
Last active November 14, 2018 20:26 — forked from vitorbritto/rm_mysql.md
Remove MySQL completely from Mac OSX
View rm_mysql.md

Remove MySQL completely

  1. Open the Terminal

  2. Use mysqldump to backup your databases

  3. Check for MySQL processes with: ps -ax | grep mysql

  4. Stop and kill any MySQL processes

  5. Analyze MySQL on HomeBrew:

brew remove mysql

@akabab
akabab / index.css
Created June 5, 2018 17:56
blurred background in CSS
View index.css
#bg {
position: fixed;
background-image: url("http://cosmetotheque.com/wp-content/uploads/2018/04/mario-gogh-589733-unsplash-1200x385.jpg");
filter: blur(2px);
width: 1000px;
height: 300px;
}
#content {
position: relative;
@akabab
akabab / db-monk.js
Last active May 26, 2018 14:45
Mongodb (w/ Monk) NodeJS + Proxy helper
View db-monk.js
const connect = require('monk')
const url = 'mongodb://localhost:27017/livecodings'
const handler = { get: (obj, prop) => obj[prop] || obj.get(prop) }
const db = new Proxy(connect(url), handler)
// db.users -> access 'users' collection instead of db.get('users')
const readUsers = async () => db.users.find({})
readUsers.byId = id => db.users.findOne({ _id: id })
View flatKeys.js
const flatKeys = (object, keys = [], k = '') => {
for (const key in object) {
const rest = k.length ? '.' + key : key
if (typeof object[key] === 'object' && !Array.isArray(object[key])) {
flatKeys(object[key], keys, k + rest)
} else {
keys.push(k + rest)
}
}