Skip to content

Instantly share code, notes, and snippets.

Avatar

BJR Matos bjrmatos

View GitHub Profile
@bjrmatos
bjrmatos / generate-consumer.js
Last active Apr 5, 2017
script to generate consumer id and secrets
View generate-consumer.js
'use strict';
var uuid = require('uuid'),
base64Url = require('base64-url'),
uuidBase62 = require('uuid-base62');
var consumer = {
key: uuidBase62.encode(uuid.v4()),
secret: base64Url.encode(uuid.v4().replace(/-/g, '')),
seed: uuid.v1().replace(/-/g, '')
@bjrmatos
bjrmatos / gist:84624daca5161e082d88
Created Oct 6, 2015 — forked from jorupp/gist:2af4d8583bd592b8331f
Lock all media queries in their current state
View gist:84624daca5161e082d88
function process(rule) {
if(rule.cssRules) {
for(var i=rule.cssRules.length-1; i>=0; i--) {
process(rule.cssRules[i]);
}
}
if(rule.type == CSSRule.MEDIA_RULE) {
if(window.matchMedia(rule.media.mediaText).matches) {
rule.media.mediaText = "all";
} else {
@bjrmatos
bjrmatos / ref-fixed-string.js
Created Sep 25, 2015 — forked from TooTallNate/ref-fixed-string.js
Fixed length "String" type, for use in `ref-struct` type definitions.
View ref-fixed-string.js
var ref = require('ref');
module.exports = FixedString;
/**
* Fixed length "String" type, for use in Struct type definitions.
* Null-terminates by default.
* Throws an Error if there's not enough space available when setting a string.
*/
View Template IISNode Web.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<!-- Virtual Directory Setup
assign virtualDirPath below a value like '/{path}'
Add below to your app code and then prepend routes with virtualDirPath
var virtualDirPath = process.env.virtualDirPath || ''; -->
@bjrmatos
bjrmatos / gsa.js
Last active Aug 26, 2015 — forked from mwcz/gsa.js
(mostly complete) CasperJS script to configure the Dynamic Navigation section of a GSA, because Google's API doesn't provide that ability...
View gsa.js
(function () {
var system = require('system');
var casper = require('casper').create({
clientScripts : [ 'jquery.min.js' ],
waitTimeout : 30000, // ms
logLevel : 'debug', // info, debug, warning, or error
verbose : system.args.indexOf('-v') >= 0
});
@bjrmatos
bjrmatos / AuthActions-Flux.js
Last active Aug 29, 2015
Flux React Auth Actions
View AuthActions-Flux.js
'use strict';
var AppDispatcher = require('../AppDispatcher');
var ActionTypes = require('../constants/ActionTypes');
var AuthActions = {
signin: function(data) {
AppDispatcher.handleViewAction({
actionType: ActionTypes.AUTH_SIGNIN,
data: data
@bjrmatos
bjrmatos / react-router-autonav.js
Last active Aug 29, 2015 — forked from iamdustan/index.jsareact-router-autonav.js
React router auto-nav component
View react-router-autonav.js
/** @flow */
require('./styles.css');
var React = require('react');
var {Link} = require('react-router');
var ignoreSplatRoutes = a => !/\*$/.test(a.path);
var ignoreDefaultRoutes = (a, b) => a !== b.defaultRoute;
var Toc = React.createClass({
View example-react-and-flow.js
/* @flow */
var React = require("react")
var Immutable = require("immutable")
// In order to use any type as props, including Immutable objects, we
// wrap our prop type as the sole "data" key passed as props.
type Component<P> = ReactClass<{},{ data: P },{}>
type Element = ReactElement<any, any, any>
@bjrmatos
bjrmatos / ref.md
Created Jun 21, 2015
Find package.json down to up