This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Q: j’ai un permission denied sur un brew install, any clue ? | |
A: mkdir -p ~/Library/Caches/Homebrew && export HOMEBREW_CACHE=$_ | |
+: export PATH=$HOME/.brew/bin:$PATH (add to '.zshrc') | |
+: rm -rf .brew && /usr/local/bin/brew update | |
l: https://github.com/Homebrew/homebrew/issues/41822 | |
Q: reset une session ? | |
A: sinon y’a un bouton “Reset home directory” au niveau des tools de synchro, so simple .. | |
Q: quelqu’un saurait comment modifier le PIN d’entrée à l’école ? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
A palindrome is a word, phrase, number, or other sequence of characters which reads the same backward or forward. | |
Examples include "amor roma", "step on no pets", "kayak", "abcdcba" | |
Next implementations are strict with capital letters, accents, punctuation, and word dividers. | |
*/ | |
// 1st shot | |
// expensive for memory: although Array.reverse() is lazy and does not create new storage (according to documentation - Swift 2.1), | |
// passing it into String initializer creates an entire new copy of the source string with reversed characters |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Iconizer shell script by Steve Richey (srichey@floatlearning.com) | |
# Modified by Rich Ellis (rich@richellis.net) based on contributions on Github from crishoj, giria | |
# https://gist.github.com/steverichey/8493f3bd31ae71a9c933/forks | |
# | |
# This is a simple tool to generate all necessary app icon sizes and the JSON file for an *EXISTING* Xcode project from one file. | |
# To use: specify the path to your vector graphic (PDF format) and the path to your Xcode folder containing Assets.xcassets | |
# Example: sh iconizer.sh MyVectorGraphic.pdf MyXcodeProject |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
idea was to resolve unexpected short-reads (when reading on stdin or pipe), read was returning less bytes than asked | |
cf. https://stackoverflow.com/a/8975581/5183171 | |
*/ | |
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
char *read_fd(int fd, int nbyte) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<!-- | |
====================================================================== | |
Volt | |
====================================================================== | |
A Sublime Text 3 / Textmate theme. | |
Copyright (c) 2017 akabab. | |
Released under the MIT License <http://opensource.org/licenses/MIT> | |
====================================================================== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 2d Arrays | |
const Array2d = (w, h = w, fillWith = undefined) => | |
Array(h).fill(fillWith).map(e => e = Array(w).fill(fillWith)) | |
// 2D array fill of 0 | |
Array(10).fill(0).map(e => e = Array(10).fill(0)) | |
// -> | |
Array2d(10, 10, 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ES5 | |
function sum (a, b) { | |
return a + b | |
} | |
// which is similar to | |
var sum = function (a, b) { | |
return a + b | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const min = (a, b) => { | |
if (a < b) { | |
return a | |
} | |
else { | |
return b | |
} | |
} | |
const min = (a, b) => a < b ? a : b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }) |
OlderNewer