Skip to content

Instantly share code, notes, and snippets.

View interglobalmedia's full-sized avatar
🎯
Just completed the Google Cybersecurity Certificate Program!

Maria Campbell interglobalmedia

🎯
Just completed the Google Cybersecurity Certificate Program!
View GitHub Profile
'use strict';
// ----------------------------------------------------------------------------
// Base Paths
// ----------------------------------------------------------------------------
var config = {
projectName: 'Proj',
browserSync: true,
basePath: {
@nickcernis
nickcernis / functions.php
Last active May 26, 2018 19:18
Add a login/logout link to the menu bar of any Genesis child theme
<?php // add everything except for this opening line to your functions file
add_filter( 'wp_nav_menu_items', 'sp_add_loginout_link', 10, 2 );
function sp_add_loginout_link( $items, $args ) {
// Change 'primary' to 'secondary' to put the login link in your secondary nav bar.
if ( $args->theme_location != 'primary' ) {
return $items;
}
@AliMD
AliMD / fix_zoom.js
Last active December 10, 2018 18:44
Liquid Auto Zoom window ;)
/*jshint strict:true, es5:true, forin:true, noarg:true, noempty:true, eqeqeq:true, bitwise:true, strict:true, undef:true, unused:true, nonew:true, browser:true, devel:true, indent:2, boss:true, curly:false, immed:false, latedef:true, newcap:true, plusplus:false, trailing:true, maxparams:4, maxerr:100, debug:false, asi:false, evil:false, expr:true, eqnull:false, esnext:false, funcscope:false, globalstrict:false, loopfunc:false */
(function(pageWidth,pageHeight,px,py){
"use strict";
var prefix='',
iv = 0,
vendors = {Webkit: 'webkit', Moz: '', O: 'o', ms: 'MS' },
testEl = document.createElement('div'),
each = function(elements, callback){
for (var key in elements)
if (callback.call(elements[key], key, elements[key]) === false) return elements;
@branneman
branneman / getMousePosition.js
Last active July 7, 2019 10:40
getMousePosition(event) - cross browser normalizing of: clientX, clientY, screenX, screenY, offsetX, offsetY, pageX, pageY
/**
* @param {Event} evt
* @return {Object}
*/
function getMousePosition(evt) {
var pageX = evt.pageX;
var pageY = evt.pageY;
if (pageX === undefined) {
pageX = evt.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
@kerryhatcher
kerryhatcher / gulpfile.js
Last active June 1, 2020 17:53
Gulp Markdown Nunjucks
'use strict';
// =======================================================================
// Gulp Plugins
// =======================================================================
var gulp = require('gulp'),
nunjucks = require('nunjucks'),
markdown = require('nunjucks-markdown'),
marked = require('marked'),
rename = require('gulp-rename'),
gulpnunjucks = require('gulp-nunjucks');
@mdp
mdp / csp_middleware.js
Created October 13, 2015 17:23
Node.js CSP
let sources = {
'default-src': ['\'self\''],
'script-src': ['\'self\'','https://*.myexternalcdn.com'],
'frame-src': ['https://someexternalframesource.com'],
'img-src': ['\'self\'', 'https:', 'data:'],
'style-src': ['\'self\'', 'https:'],
'font-src': ['\'self\'', 'https:'],
'connect-src': ['\'self\''],
}
@barbwiredmedia
barbwiredmedia / paginate.php
Last active October 31, 2021 02:37
Wordpress pagination - paginate links http://codex.wordpress.org/Function_Reference/paginate_links No plugins required. Minor styling needed OR used bootstrap assitance: http://www.ordinarycoder.com/paginate_links-class-ul-li-bootstrap/
<?php echo paginate_links( $args ); ?>
<!--OR-->
<?php
//custom paginaiton with styling from bootstrap
function custom_pagination() {
global $wp_query;
$big = 999999999; // need an unlikely integer
$pages = paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
@jagdeepsingh
jagdeepsingh / README.md
Last active December 9, 2021 10:26
Set up macOS Catalina 10.15 with development tools | Git | Homebrew | rbenv | bundler | Atom | Databases | Node.js | Yarn | kubectl | Elastic Stack
@scneptune
scneptune / crossfading
Created November 16, 2013 09:21
Use the Web Audio API to crossfade between two sources. taken directly from http://www.html5rocks.com/en/tutorials/webaudio/intro/ for the purposes of understanding audio
var CrossfadeSample = {playing:false};
CrossfadeSample.play = function() {
// Create two sources.
this.ctl1 = createSource(BUFFERS.drums);
this.ctl2 = createSource(BUFFERS.organ);
// Mute the second source.
this.ctl1.gainNode.gain.value = 0;
// Start playback in a loop
if (!this.ctl1.source.start) {
@afeld
afeld / gist:4952991
Last active February 8, 2022 03:13
good APIs for mashups

This list has been superseded by Public APIs. Check there for APIs with Auth: No, HTTPS and CORS Yes.


List of data APIs that require no server-side auth or private credentials, and are thus good for small browser-only JS projects.