Skip to content

Instantly share code, notes, and snippets.

View matthewstokeley's full-sized avatar
🎯
Focusing

Matthew Stokeley matthewstokeley

🎯
Focusing
View GitHub Profile
@ryankearney
ryankearney / ComcastInject.html
Last active June 10, 2023 14:40
This is the code Comcast is injecting into its users web traffic.
<script language="JavaScript" type="text/javascript">
// Comcast Cable Communications, LLC Proprietary. Copyright 2012.
// Intended use is to display browser notifications for critical and time sensitive alerts.
var SYS_URL='/e8f6b078-0f35-11de-85c5-efc5ef23aa1f/aupm/notify.do';
// var image_url='http://servicealerts.comcast.net:8080/images/mt';
var image_url='http://xfinity.comcast.net/constantguard/BotAssistance/notice/images';
var headertext1='<strong>Comcast Courtesy Notice</strong>';
var textline1='You have reached 90% of your <b>monthly data usage allowance</b>.';
var textline2='Please sign in for more information and to remove this alert.';
var acknowledgebutton='<a href=\"#\" onClick="document.location.href=\''+SYS_URL+'?dispatch=redirect&redirectName=login&paramName=bmUid\'" title="Sign in to acknowledge" style="color: #FFFFFF;"><img alt="Sign in to acknowledge" src="'+image_url+'/mt_signin.png"/></a>';
@kyleondata
kyleondata / gist:3440492
Last active February 1, 2023 19:23
Backbone.js and Handlebars.js example
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=utf-8" />
<script src="jquery-1.7.2.min.js" ></script>
<script src="handlebars-1.0.0.beta.6.js" ></script>
<script src="underscore-min.js" ></script>
<script src="backbone-min.js" ></script>
@chrisvanpatten
chrisvanpatten / README.md
Created March 7, 2012 16:27
WordPress Admin Tabs

Huh?

Believe it or not, WordPress doesn't have a fully-fleshed out common tab style for plugins or theme authors to use in metaboxes.

The style exists for categories, but it hasn't been fully adapted for the half-complete wp-tab setup. Trac ticket #17959 has a solution that not only fleshes the style but it also adds a global JavaScript file to give the wp-tab HTML some action. Until that ticket is accepted into core, this Gist adapts that code so it's available to use independently in your theme or plugin.

How?

Just enqueue the CSS and JavaScript in the admin_enqueue_scripts script hook and drop the tab HTML in a metabox. It will automatically adapt to the normal and side column widths, much like category tabs.

@cs278
cs278 / is_serialized.php
Created October 23, 2009 18:25
PHP is_serialized() function.
<?php
/**
* This program is free software. It comes without any warranty, to
* the extent permitted by applicable law. You can redistribute it
* and/or modify it under the terms of the Do What The Fuck You Want
* To Public License, Version 2, as published by Sam Hocevar. See
* http://sam.zoy.org/wtfpl/COPYING for more details.
*/
/**
@mxstbr
mxstbr / Field.js
Last active February 23, 2022 07:39 — forked from hungrysquirrel/Field.js
Style Storybook with Styled Components
import React, { PropTypes } from 'react';
import styled from 'styled-components'
const Wrapper = styled.div`
// styles here that used to be for .test
`
const Label = styled.label`
// label styles here
`
@nathansmith
nathansmith / config.rb
Created August 29, 2011 21:00
Example config.rb file for Compass
preferred_syntax = :sass
http_path = '/'
css_dir = 'assets/stylesheets'
sass_dir = 'assets/sass'
images_dir = 'assets/images'
javascripts_dir = 'assets/javascripts'
relative_assets = true
line_comments = true
# output_style = :compressed
@wildlyinaccurate
wildlyinaccurate / event.js
Last active February 12, 2021 01:05
Really simple Javascript custom event system
var Event = function() {
var self = this;
self.queue = {};
self.fired = [];
return {
fire: function(event) {
@matthewstokeley
matthewstokeley / object-mutator-for-event-driven-data-mapping.js
Last active September 29, 2020 12:12
an object mutator for functional, compositional event-based data mapping with dependency injection and closures
// an object mutator for a functional, compositional event-based data mapper with closures
const store = {}
const shallowCloneObject = store => Object.assign({}, store)
// const store = shallowCloneObject(original)l
function defineProperty (
object: Object,
import {Object, Tuple, Number} from 'ts-toolbelt'
// Merge two types together
type merge = Object.MergeUp<{name: string}, {age?: number}>
// Update the type of a field
type update = Object.Update<{age: string}, 'age', number>
// Make some fields optional
type optional = Object.Optional<{name: string, age: number}, 'age'>
@Thinkscape
Thinkscape / PSR-0-final-proposal.md
Created September 22, 2011 10:30
PSR-0 Final Proposal (PHP Standards Working Group)

PSR-0 Final Proposal (PHP Standards Working Group)

The following describes the mandatory requirements that must be adhered to for autoloader interoperability.

Mandatory:

  • A fully-qualified namespace and class must have the following structure \ <Vendor Name> \ (<Namespace>)* \ <Class Name>
  • Each namespace must have a top-level namespace ("Vendor Name").
  • Each namespace can have as many sub-namespaces as it wishes.
  • Each namespace separator is converted to a DIRECTORY_SEPARATOR when loading from the file system.
  • Each "_" character in the CLASS NAME is converted to a DIRECTORY_SEPARATOR. The "_" character has no special meaning in the namespace.