Skip to content

Instantly share code, notes, and snippets.

View jbutko's full-sized avatar

Jozef Butko jbutko

View GitHub Profile
@romuloctba
romuloctba / functions.php
Created September 24, 2014 04:33
Add all custom fields to JSON REST API wordpress
function json_api_prepare_post( $post_response, $post, $context ) {
$field = get_post_custom($post['ID']);
$post_response['custom-fields'] = $field;
return $post_response;
}
add_filter( 'json_prepare_post', 'json_api_prepare_post', 10, 3 );
@ondrek
ondrek / boilerplate.js
Last active August 29, 2015 14:09
sample of controller boilerplate
;(function(){
/**
* The recovery controller provides functionality for:
* (1) resetting password,
* (2) setting a new one
* (3) and switching between views
*/
@akarve
akarve / og-boilerplate.html
Last active November 12, 2023 13:35
Facebook Open Graph tags. Boilerplate for HTML pages.
<!-- Reference: https://developers.facebook.com/docs/sharing/best-practices#tags -->
<!-- CORE og -->
<!-- Title, without branding. -->
<meta property="og:title" content="" />
<!-- Name, not URL (e.g. Apple, not apple.com) -->
<meta property="og:site_name" content="" />
<!-- URL. Should match canonical URL for SEO. Unique identifier for your article. -->
<meta property="og:url" content="" />
<!-- OPTIONAL description. 2-4 sentences. -->
<meta property="og:description" content="" />
@jbutko
jbutko / gulpfile.js
Last active February 13, 2019 06:25
BrowserSync + Gulp.js: Simple webServer + liveReload + watching CSS, HTML and SASS files
/**
* This example:
* Uses the built-in BrowserSync server for HTML files
* Watches & compiles SASS files
* Watches & injects CSS files
*
* More details: http://www.browsersync.io/docs/gulp/
*
* Install:
* npm install browser-sync gulp gulp-sass --save-dev
@paulirish
paulirish / readme.md
Last active April 2, 2024 20:18
resolving the proper location and line number through a console.log wrapper

console.log wrap resolving for your wrapped console logs

I've heard this before:

What I really get frustrated by is that I cannot wrap console.* and preserve line numbers

We enabled this in Chrome DevTools via blackboxing a bit ago.

If you blackbox the script file the contains the console log wrapper, the script location shown in the console will be corrected to the original source file and line number. Click, and the full source is looking longingly into your eyes.

@npatmaja
npatmaja / async-propagate-callback.js
Created May 5, 2015 07:25
propagate async callback usefull when using async.waterfall with mongoose
// to propagate async callback
// usefull when using async.waterfall
// with mongoose
async.waterfall([
task1(),
task2(),
task3()
], callFinalCallback());
@gaearon
gaearon / ReduxMicroBoilerplate.js
Last active March 26, 2020 00:35
Super minimal React + Redux app
import React, { Component } from 'react';
import { createStore, combineReducers, applyMiddleware, bindActionCreators } from 'redux';
import { provide, connect } from 'react-redux';
import thunk from 'redux-thunk';
const AVAILABLE_SUBREDDITS = ['apple', 'pics'];
// ------------
// reducers
// ------------
@zhujunsan
zhujunsan / Using Github Deploy Key.md
Last active June 30, 2025 23:37
Using Github Deploy Key

What / Why

Deploy key is a SSH key set in your repo to grant client read-only (as well as r/w, if you want) access to your repo.

As the name says, its primary function is to be used in the deploy process in replace of username/password, where only read access is needed. Therefore keep the repo safe from the attack, in case the server side is fallen.

How to

  1. Generate a ssh key
@xrstf
xrstf / letsencrypt.md
Last active October 30, 2024 07:03
Let's Encrypt on Ubuntu 14.04, nginx with webroot auth

Let's Encrypt on Ubuntu 14.04, nginx with webroot auth

This document details how I setup LE on my server. Firstly, install the client as described on http://letsencrypt.readthedocs.org/en/latest/using.html and make sure you can execute it. I put it in /root/letsencrypt.

As it is not possible to change the ports used for the standalone authenticator and I already have a nginx running on port 80/443, I opted to use the webroot method for each of my domains (note that LE does not issue wildcard certificates by design, so you probably want to get a cert for www.example.com and example.com).

Configuration

For this, I placed config files into etc/letsencrypt/configs, named after <domain>.conf. The files are simple:

@cecilemuller
cecilemuller / letsencrypt_2020.md
Last active January 9, 2025 12:22
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files: