Skip to content

Instantly share code, notes, and snippets.

View jbutko's full-sized avatar

Jozef Butko jbutko

View GitHub Profile
@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.

@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
@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="" />
@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
*/
@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 );
@romuloctba
romuloctba / gist:a0e4cdc93cc2088da10e
Created September 24, 2014 04:27
Add Custom Fields from ACF to JSON REST API Wordpress functions.php
function json_api_prepare_post( $post_response, $post, $context ) {
$field = get_fields($post['ID']);
$post_response['custom-fields'] = $field;
return $post_response;
}
add_filter( 'json_prepare_post', 'json_api_prepare_post', 10, 3 );
app.directive('backButton', ['$window', function($window) {
return {
restrict: 'A',
link: function (scope, elem, attrs) {
elem.bind('click', function () {
$window.history.back();
});
}
};
}]);
'use strict';
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
var options = {};
options.sass = {
errLogToConsole: true,
sourceMap: 'sass',
@sheharyarn
sheharyarn / mongo_backup.sh
Last active December 12, 2024 15:16
Mongodump Shell Script for Cronjob
#!/bin/bash
MONGO_DATABASE="your_db_name"
APP_NAME="your_app_name"
MONGO_HOST="127.0.0.1"
MONGO_PORT="27017"
TIMESTAMP=`date +%F-%H%M`
MONGODUMP_PATH="/usr/bin/mongodump"
BACKUPS_DIR="/home/username/backups/$APP_NAME"
@rinatio
rinatio / gist:f22fd508bfba28eedbb7
Created June 25, 2014 12:17
AngularJS $q promise resolved flag
'use strict';
angular.module('testQDecorator', [])
.config(function($provide) {
$provide.decorator('$q', function($delegate) {
function decoratePromise(promise) {
var then = promise.then;
promise.resolved = false;
promise.finally(function() {
promise.resolved = true;