Skip to content

Instantly share code, notes, and snippets.

@garciamax
garciamax / canvas.html
Created July 13, 2021 18:39
canvas example
<style>
#myCanvas{
width: 100%;
height: 100%;
}
</style>
<canvas id="myCanvas"></canvas>
<script>
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
</head>
<body>
<div id="app" class="row"></div>
@garciamax
garciamax / .babelrc
Created December 29, 2017 06:24
webpack + react + babel
{
"presets": ["env", "react"]
}
@garciamax
garciamax / .vimrc
Created March 18, 2017 11:31
Minimal vimrc file
set encoding=utf-8
syntax on
set nu
set laststatus=2
set showmode
set title
@garciamax
garciamax / react-minimal.html
Created July 25, 2016 13:38
React minimal CDN
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>★React Boilerplate★</title>
<script src="//cdnjs.cloudflare.com/ajax/libs/react/15.2.1/react.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/react/15.2.1/react-dom.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.34/browser.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/remarkable/1.6.2/remarkable.min.js"></script>
@garciamax
garciamax / nesting_verify.js
Created May 19, 2016 12:42
Solve matching parentheses problem.
var results = new Array();
var l = console.log.bind(console)
//Task
results.push(verify("---(++++)----"));// -> true
results.push(verify(""));// -> true
results.push(verify("before ( middle []) after "));// -> false
results.push(verify(") ("));// -> false
results.push(verify("} {"));// -> true
results.push(verify("<(   >)"));// -> false
@garciamax
garciamax / plugin.js
Last active August 29, 2015 13:58
Plugin Starter
(function( $ ) {//my scope
var _obj = {},//container for plugin
_appName = 'MYDEFAULTPLUGINNAME';//will be visible in global scope, use unique name
_obj[_appName] = window[_appName] = new function(){//exposing to global scope
var _ = {//private methods
defaults:{},
settings:{},
l:function(severity, message) {
var _args = Array.prototype.slice.apply(arguments);
console[severity](_appName + ' :: ' + _args.slice(1, 2), _args.slice(2));
@garciamax
garciamax / screenshot.js
Created October 3, 2013 13:12
screenshot multiple urls with phantomjs.
var page = require('webpage').create();
page.onConsoleMessage = function (msg) {
// console.log(msg);
};
var items = [
{name:'espn',url:'http://espn.go.com/nfl/'},
{name:'google',url:'http://google.com/'},
];// array with items.
(function recursion(){
if(items.length == 0) phantom.exit();