반응형

배낭 짐 꾸리기, 비박시 능률적인 수면방식

 

반응형
반응형

[지진대비 생존배낭 뭐가 중요한가?] 2년 6개월 동안 고민과 테스트를 해본 10만원 생존배낭 꾸리는 법 1부 "지진대비 생존배낭에 대한 이해"

https://youtu.be/jCknnQnckps

https://youtu.be/oczfjZQ-O1o

https://youtu.be/QnVPNOPRUDM

 

반응형
반응형

행복은 산 정상에서 나오는 잠깐의 만족이 아니라,
산을 오르는 길에서 느끼는 희망이다.
행복은 희망에서 나온다.
지금 걷는 길이 아무리 멀고 험해도 희망이 있다면 불행하지 않다.
- 조던 피터슨, ‘12가지 인생의 법칙’에서 

니체는 ‘왜 살아야 하는지를 아는 사람, 삶의 의미를 아는 사람은
어떻게든 살아갈 수 있다’고 말했습니다.
사람은 누구나 희망과 의미를 찾아내는 능력을 갖고 있습니다.
미래를 향한 기대와 희망을 가지면 누구나 행복할 수 있습니다.

반응형
반응형

문제가 줄어들었다고 해서
행복해지는 것은 아니다. 행복은
긍정적 목표를 세우고, 에너지를 집중하여
대안들을 생성해 내고, 이를 실행으로 옮길 때
비로소 찾아 온다. 노력으로 얻어지는 것이지,
흔히들 생각하듯 지금의 문제나 불행한
상황들이 없어지기만 하면 저절로
행복이 따라오는 것이 아니다. 

- 이정미의《심리학이 나를 안아주었다》중에서 -


* 긍정적 목표가 먼저입니다.
그 다음은 집중이고, 그 다음은 실행입니다.
행복은 그 다음에 저절로 뒤따라 오는 것입니다.
처음부터 두려움이 크거나 부정적이면
결과도 부정적일 수밖에 없습니다.
긍정적 목표로 출발하면
가는 길이 행복입니다.

반응형

'생활의 발견 > 아침편지' 카테고리의 다른 글

나는 나다  (0) 2020.01.04
자기 그림을 그리는 사람  (0) 2020.01.03
새해 복 많이 지으세요!  (0) 2020.01.02
희열을 느끼는 순간  (0) 2019.12.31
낯선 풍경이 말을 걸어왔다  (0) 2019.12.30
반응형

이제는
새해 인사를 드려야겠다.
'새해 복 많이 받으세요!'
복은 어느 누가 주는 것이 아니라
내가 지어서 내가 받는 것, 그렇다면
인사말을 이렇게 고쳐 해야겠네,
'새해에는 복을 많이 지으십시오!'

- 법정의《새들이 떠나간 숲은 적막하다》중에서 -


* 새해 인사를
'새해 복 많이 지으세요!'로 바꾸자는
법정 스님의 말씀이 가슴에 와닿습니다.
복을 받기도 하고 주는 것이기도 하지만
짓는 것이기도 합니다. 잘 지은 집처럼
내가 지어 내가 살기도 하고
다른 사람이 살기도 합니다.
복이 복을 짓습니다.

반응형

'생활의 발견 > 아침편지' 카테고리의 다른 글

자기 그림을 그리는 사람  (0) 2020.01.03
긍정적 목표가 먼저다  (0) 2020.01.02
희열을 느끼는 순간  (0) 2019.12.31
낯선 풍경이 말을 걸어왔다  (0) 2019.12.30
상대를 바꾸려는 마음  (0) 2019.12.28
반응형

인생의 의미는 끊임없이 다른 존재로 되어가기의 과정에서 발견되는 것이다.

반응형
반응형

동문시장 청양수산 회포장

늘 전화주문하고 받으러갑니다~ 좋아요~  제주특별자치도 제주시 오현길 90 

064-753-1510

 

반응형
반응형

12 Extremely Useful Hacks for JavaScript

https://github.com/maketroli/js-hacks/blob/master/README.md

 

maketroli/js-hacks

12 Extremely Useful Hacks for JavaScript. Contribute to maketroli/js-hacks development by creating an account on GitHub.

github.com

1) Converting to boolean using !! operator

function Account(cash) {
    this.cash = cash;
    this.hasMoney = !!cash;
}

var account = new Account(100.50);
console.log(account.cash); // 100.50
console.log(account.hasMoney); // true

var emptyAccount = new Account(0);
console.log(emptyAccount.cash); // 0
console.log(emptyAccount.hasMoney); // false

2) Converting to number using + operator

function toNumber(strNumber) {
    return +strNumber;
}

console.log(toNumber("1234")); // 1234
console.log(toNumber("ACB")); // NaN
This magic will work with Date too and, in this case, it will return the timestamp number:

console.log(+new Date()) // 1461288164385

3) Short-circuits conditionals

if (conected) {
    login();
}

conected && login();

user && user.login();

4) Default values using || operator

function User(name, age) {
    this.name = name || "Oliver Queen";
    this.age = age || 27;
}

var user1 = new User();
console.log(user1.name); // Oliver Queen
console.log(user1.age); // 27

var user2 = new User("Barry Allen", 25);
console.log(user2.name); // Barry Allen
console.log(user2.age); // 25

5) Caching the array.length in the loop

/*
This tip is very simple and causes a huge impact on the performance when 
processing large arrays during a loop. Basically, 
almost everybody writes this synchronous for to iterate an array:
*/
for(var i = 0; i < array.length; i++) {
    console.log(array[i]);
}

/*
If you work with smaller arrays – it’s fine, but if you process large arrays, 
this code will recalculate the size of array in every iteration of this loop and 
this will cause a bit of delays. 
To avoid it, you can cache the array.length in a variable to use it instead of invoking 
the array.length every time during the loop:
*/
var length = array.length;
for(var i = 0; i < length; i++) {
    console.log(array[i]);
}

//-- To make it smaller, just write this code:
for(var i = 0, length = array.length; i < length; i++) {
    console.log(array[i]);
}

; }

6) Detecting properties in an object

This trick is very useful when you need to check if some attribute exists and it avoids running undefined functions or attributes. If you are planning to write cross-browser code, probably you will use this technique too. For example, let’s imagine that you need to write code that is compatible with the old Internet Explorer 6 and you want to use the document.querySelector(), to get some elements by their ids. However, in this browser this function doesn’t exist, so to check the existence of this function you can use the in operator, see this example:

if ('querySelector' in document) {
    document.querySelector("#id");
} else {
    document.getElementById("id");
}

7) Getting the last item in the array

The Array.prototype.slice(begin, end) has the power to cut arrays when you set the begin and end arguments. But if you don’t set the end argument, this function will automatically set the max value for the array. I think that few people know that this function can accept negative values, and if you set a negative number as begin argument you will get the last elements from the array:

var array = [1,2,3,4,5,6];
console.log(array.slice(-1)); // [6]
console.log(array.slice(-2)); // [5,6]
console.log(array.slice(-3)); // [4,5,6]

8) Array truncation

var array = [1,2,3,4,5,6];
console.log(array.length); // 6
array.length = 3;
console.log(array.length); // 3
console.log(array); // [1,2,3]

9) Replace all

The String.replace() function allows using String and Regex to replace strings, natively this function only replaces the first occurrence. But you can simulate a replaceAll() function by using the /g at the end of a ​Regex:

var string = "john john";
console.log(string.replace(/hn/, "ana")); // "joana john"
console.log(string.replace(/hn/g, "ana")); // "joana joana"

10) Merging arrays

var array1 = [1,2,3];
var array2 = [4,5,6];
console.log(array1.concat(array2)); // [1,2,3,4,5,6];

/*
However, this function is not the most suitable to merge large arrays 
because it will consume a lot of memory by creating a new array. 
In this case, you can use Array.push.apply(arr1, arr2) which 
instead creates a new array – it will merge the second array in 
the first one reducing the memory usage:
*/
var array1 = [1,2,3];
var array2 = [4,5,6];
console.log(array1.push.apply(array1, array2)); // [1,2,3,4,5,6];

11) Converting NodeList to Arrays

If you run the document.querySelectorAll("p") function, it will probably return an array of DOM elements, the NodeList object. But this object doesn’t have all array’s functions, like: sort(), reduce(), map(), filter(). In order to enable these and many other native array’s functions you need to convert NodeList into Arrays. To run this technique just use this function: [].slice.call(elements):

var elements = document.querySelectorAll("p"); // NodeList
var arrayElements = [].slice.call(elements); // Now the NodeList is an array
var arrayElements = Array.from(elements); // This is another way of converting NodeList to Array

12) Shuffling array’s elements

var list = [1,2,3];
console.log(list.sort(function() { Math.random() - 0.5 })); // [2,1,3]

 

​#javascript

#!! #operator #+ #number

#Short-circuit

#array.length #loop

#detecting #properties #object

#item #array

#array_truncation

#replaceAll #replace

#merging #array #merging_array

#NodeList to #Array

#Shuffling #elements

반응형

+ Recent posts