Skip to content

Instantly share code, notes, and snippets.

@yamoo9
yamoo9 / ajax.js
Last active May 4, 2019 13:42
Ajax 심플 라이브러리 (수업용)
(function(global){
'use strict';
var JSON = global.JSON;
// @private
function whatType(o) {
return Object.prototype.toString.call(o).slice(8,-1).toLowerCase();
}
@yamoo9
yamoo9 / dom.oo.js
Last active May 4, 2019 13:43
DOM 스크립트 라이브러리 - 객체 지향 프로그래밍
(function(global, document){
// @private
function getStyle(el, prop, pseudo) {
return window.getComputedStyle(el, pseudo)[prop];
}
function setStyle(el, prop, value) {
return el.style[prop] = value;
}
@yamoo9
yamoo9 / dom.fn.js
Last active February 13, 2020 09:42
DOM 스크립트 라이브러리 - 함수형 프로그래밍
(function(global, document) {
'use strict';
var namespace = 'y9';
function el(selector, context) {
return (context || document).querySelector(selector);
}
function els(selector, context) {
return (context || document).querySelectorAll(selector);
@tunguskha
tunguskha / Gradient shadow in pure CSS.md
Last active October 12, 2024 17:02
Gradient shadow in pure CSS

Gradient shadow in pure CSS

alt text

HTML
<button>Let's Go !</button>
@yamoo9
yamoo9 / helper.js
Last active February 11, 2020 15:48
helper.js
(function(global, document){
'use strict';
/* -----------------------------------------------------
* DOM 선택 헬퍼 함수 */
function els(selector, context) {
if (typeof selector !== 'string' || selector.trim().length === 0) { return null; }
context = !context ? document : context.nodeType === 1 ? context : el(String(context));
return context.querySelectorAll(selector);
@kennychufk
kennychufk / file-system-check-failure.sh
Created February 8, 2018 09:16
Arch Linux troubleshooting
# Failed to boot:
# Failed to start file system check on /dev/disk/by-uuid/....
journalctl -xb
# (look at the disk label that fsck failed)
fsck /dev/sda3
#
@aerrity
aerrity / client.js
Last active June 1, 2025 16:35
Node, Express & MongoDB: Button click example
console.log('Client-side code running');
const button = document.getElementById('myButton');
button.addEventListener('click', function(e) {
console.log('button was clicked');
fetch('/clicked', {method: 'POST'})
.then(function(response) {
if(response.ok) {
console.log('click was recorded');
/* *******************************************************************************************
* GLOBAL OBJECTS > ARRAY
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
* ******************************************************************************************* */
// Global object: properties
Array.length // Reflects the number of elements in an array
// Global object: methods
1-In the github repo on Settings > Integration & Services, enable
2-Go to travisCI page and enable the repo
3-Configure the env variables on TravisCI so that it is not necessary to save credentials on github
-in the project Settings on TravisCI, add the entry for netlify site id: NETLIFY_SITE_ID - <site_id from .netlify file generated on netlify create>
-create a netlify access token for TravisCI
-On Netlify Dashboard, Go to Account Settings > OAuth Applications (https://app.netlify.com/account/applications) > Personal access tokens and press New Access Token
-Name it anything, but to make it easier the suggestion is name TravisCI.
-Generate it and COPY it - you won’t see it again!
-in the project Settings on TravisCI, add the entry for netlify personal access token generated for TravisCI: NETLIFY_ACCESS_TOKEN
4-Generate a .travis.yml file in the local repo
@vpzed
vpzed / mock.py
Last active December 22, 2022 22:25
Simple asyncpg test script with jsonb field (python 3.6.3, Postgres 10.0, and asyncpg 0.13.0)
#!/usr/bin/env python
# Use /usr/bin/env python to support virtual environments
# This script is for Python > 3.6
# -*- coding: utf-8 -*-
"""
Test loading mock initial alliances data into a test table with asyncpg and Postgres
"""
import datetime
import json