Skip to content

Instantly share code, notes, and snippets.

View bjrmatos's full-sized avatar

BJR Matos bjrmatos

View GitHub Profile
@bjrmatos
bjrmatos / generate-consumer.js
Last active April 5, 2017 17:08
script to generate consumer id and secrets
'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 October 6, 2015 04:55 — forked from jorupp/gist:2af4d8583bd592b8331f
Lock all media queries in their current state
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 September 25, 2015 03:52 — forked from TooTallNate/ref-fixed-string.js
Fixed length "String" type, for use in `ref-struct` type definitions.
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.
*/
<?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 August 26, 2015 21:44 — 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...
(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 August 29, 2015 14:23
Flux React Auth Actions
'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 August 29, 2015 14:23 — forked from iamdustan/index.jsareact-router-autonav.js
React router auto-nav component
/** @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({
/* @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 June 21, 2015 03:28
Find package.json down to up