Skip to content

Instantly share code, notes, and snippets.

@KEINOS
KEINOS / README.md
Last active May 14, 2024 03:42
[macOS] Terminal app crashes right-away on start even in safe-mode

Question

I have a MacBookPro with Monterey (OSX 12.6.9) installed. When I start the terminal("Terminal.app" application), the application crashes right away. It even crashes in safe-mode boot of the OS. What can I do or check to solve this problem?

Answer

If Terminal.app is crashing immediately upon launch, it can be a frustrating issue to deal with.

@JeffreyWay
JeffreyWay / set-value.md
Created July 28, 2012 19:09
PHP: Set value if not exist

You know how, in JavaScript, we can set a value to a variable if one doesn't, like this:

name = name || 'joe';

This is quite common and very helpful. Another option is to do:

name || (name = 'joe');
@MikeRogers0
MikeRogers0 / resize-image.js
Last active May 14, 2024 03:41
An example of how to resize an image on the fly with javascript.
// The function that scales an images with canvas then runs a callback.
function scaleImage(url, width, height, liElm, callback){
var img = new Image(),
width = width,
height = height,
callback;
// When the images is loaded, resize it in canvas.
img.onload = function(){
var canvas = document.createElement("canvas"),
@nikbabchenko
nikbabchenko / resize-image.js
Created August 24, 2018 21:16 — forked from MikeRogers0/resize-image.js
An example of how to resize an image on the fly with javascript.
// The function that scales an images with canvas then runs a callback.
function scaleImage(url, width, height, liElm, callback){
var img = new Image(),
width = width,
height = height,
callback;
// When the images is loaded, resize it in canvas.
img.onload = function(){
var canvas = document.createElement("canvas"),
@joepie91
joepie91 / sessions.md
Last active May 14, 2024 03:40
Introduction to sessions

While a lot of Node.js guides recommend using JWT as an alternative to session cookies (sometimes even mistakenly calling it "more secure than cookies"), this is a terrible idea. JWTs are absolutely not a secure way to deal with user authentication/sessions, and this article goes into more detail about that.

Secure user authentication requires the use of session cookies.

Cookies are small key/value pairs that are usually sent by a server, and stored on the client (often a browser). The client then sends this key/value pair back with every request, in a HTTP header. This way, unique clients can be identified between requests, and client-side settings can be stored and used by the server.

Session cookies are cookies containing a unique session ID that is generated by the server. This session ID is used by the server to identify the client whenever it makes a request, and to associate session data with that request.

*S

@nikbabchenko
nikbabchenko / mapdispatch-to-props.js
Created March 31, 2019 13:22
MapDispatchToProps
/**
*
* bindActionCreators approach
*
**/
function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators(courseActions, dispatch)
}
@nikbabchenko
nikbabchenko / config.js
Created June 13, 2019 15:35
GlobalStyles for Stencil.js
{
globalStyle: './src/global/default.scss',
plugins: [
sass({
includePaths: ['./node_modules'],
injectGlobalPaths: ['./src/global/_variables.scss'],
}),
],
}
@nikbabchenko
nikbabchenko / reducer.js
Created June 18, 2019 07:02
Create reducer
export const createReducer = (initialState, handlers)=>{
return function reducer(state = initialState, action) {
if (handlers.hasOwnProperty(action.type)) {
return handlers[action.type](state, action)
} else {
return state
}
}
};

A complete list of books, articles, blog posts, videos and neat pages that support Data Fundamentals (H), organised by Unit.

Formatting

If the resource is available online (legally) I have included a link to it. Each entry has symbols following it.

  • ⨕⨕⨕ indicates difficulty/depth, from ⨕ (easy to pick up intro, no background required) through ⨕⨕⨕⨕⨕ (graduate level textbook, maths heavy, expect equations)
  • ⭐ indicates a particularly recommended resource; 🌟 is a very strongly recommended resource and you should look at it.
@nikbabchenko
nikbabchenko / makeActionCreator.js
Created June 18, 2019 07:04
MakeActionCreator
export const makeActionCreator = (type, ...argNames) => {
return function(...args) {
let action = { type };
argNames.forEach((arg, index) => {
action[argNames[index]] = args[index];
});
return action
}
};