Skip to content

Instantly share code, notes, and snippets.

View bjrmatos's full-sized avatar

BJR Matos bjrmatos

View GitHub Profile
@bjrmatos
bjrmatos / friday_deploy.txt
Last active March 25, 2023 17:57 — forked from mathroc/friday_deploy.txt
Friday Deploy ascii image
┐┌┐┌┐
┘└┘└┘\ₒ/
┐┌┐┌┐ ∕ Friday
┘└┘└┘ノ)
┐┌┐┌┐ deploy,
┘└┘└┘
┐┌┐┌┐ good
┘└┘└┘
┐┌┐┌┐ luck!
│││││
@bjrmatos
bjrmatos / gist:1dfd15059b5a9969a6a0
Last active May 24, 2022 19:21 — forked from georgeOsdDev/gist:9501747
Disable JS execution in console
// Disable javascript execution from console
// http://kspace.in/blog/2013/02/22/disable-javascript-execution-from-console/
var _z = console;
Object.defineProperty( window, "console", {
get : function(){
if( _z._commandLineAPI ){
throw "Sorry, Can't exceute scripts!";
}
return _z;
},
<?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 / dotslashtaskdotjs.markdown
Last active May 19, 2016 11:53
task runner - only plain JS

why ./task.js?

One word: task automation. It's basically zero effort and you can use the ./task.js package manager to handle any repetitive tasks. You can use ./task.js to automate everything with minimum effort.

./task.js provides the structure, order, and authority that you as a developer so desperately crave. ./task.js will also take responsibility for your actions if you need it to. It's what everybody is using now. ./task.js is the new hotness. It's all about ./task.js now, just like that.

This is compared to npm run/bash scripts, which are:

@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.
*/
@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({
@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
/* @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>

repeat(a) -> [a]

Inspired by Haskell, I wanted to see if I could replicate, using ES6 features, the repeat function:

repeat :: a -> [a]

So as you can see in repeat.js, I have done exactly that. However there are some caveats.