Skip to content

Instantly share code, notes, and snippets.

View jeanmachuca's full-sized avatar

Jean Machuca jeanmachuca

View GitHub Profile
@jeanmachuca
jeanmachuca / createapp.sh
Last active December 5, 2021 00:56
Generate a QCObjects New App with Bash
# Usage:
# ./createapp.sh myappname
#
app=$1
mkdir $app && cd $app
# get the command line parameter to set the name to the app to generate (simulating press ENTER to the git repo answer)
echo -ne '\n' | qcobjects create $app
# download official gitignore file
curl -lL https://raw.githubusercontent.com/QuickCorp/qcobjects-new-app/master/.gitignore > .gitignore
@jeanmachuca
jeanmachuca / index.html
Created November 8, 2020 01:39
Append 10 div elements to body (0 to 9 indexes)
<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width" />
<!-- This is a wide open CSP declaration. To lock this down for production, see below. -->
<meta http-equiv="Content-Security-Policy" content="default-src * 'self' 'unsafe-inline' 'unsafe-eval' data: gap: https://ssl.gstatic.com; img-src * 'self' data:; child-src *; style-src * 'self' 'unsafe-inline' 'unsafe-eval'; script-src * 'self' 'unsafe-inline' 'unsafe-eval'; connect-src * 'self' 'unsafe-inline' 'unsafe-eval';media-src *">
<title>QCObjects Hello World</title>
<script type="text/javascript" src="https://qcobjects.dev/QCObjects.js"></script>
@jeanmachuca
jeanmachuca / index.html
Created November 8, 2020 01:26
Hello World with QCObjects (Dynamic Inline Component Injection)
<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width" />
<!-- This is a wide open CSP declaration. To lock this down for production, see below. -->
<meta http-equiv="Content-Security-Policy" content="default-src * 'self' 'unsafe-inline' 'unsafe-eval' data: gap: https://ssl.gstatic.com; img-src * 'self' data:; child-src *; style-src * 'self' 'unsafe-inline' 'unsafe-eval'; script-src * 'self' 'unsafe-inline' 'unsafe-eval'; connect-src * 'self' 'unsafe-inline' 'unsafe-eval';media-src *">
<title>QCObjects Hello World</title>
<script type="text/javascript" src="https://qcobjects.dev/QCObjects.js"></script>
@jeanmachuca
jeanmachuca / newcanvas.js
Created June 16, 2019 02:19
Append a new Canvas to Body using QCObjects
// This will create a QCObjects class named "canvas" extending a HTMLCanvasElement with a customAttr property that has a "custom" value
Class('canvas',HTMLCanvasElement,{
customAttr:'custom'
});
// This will declare an instance canvas1 from the class canvas
let canvas1 = New(canvas,{
width:100,
height:100,
});
@jeanmachuca
jeanmachuca / customclass.js
Created June 16, 2019 02:18
QCObjects Class Declaration Example
Class('MyClassName',InheritClass,{
propertyName1:0, // just to declare purpose
propertyName2:'',
classMethod1: function (){
// some code here
// note you can use "this" object
return this.propertyName1;
},
classMethod2: function () {
// some code here
@jeanmachuca
jeanmachuca / cache_example.js
Last active June 16, 2019 02:17
QCObjects ComplexCacheControl Example
var dataObject = {id:1,
prop1:1,
prop2:2
};
var cache = new ComplexStorageCache({
index: dataObject.id,
load: (cacheController) => {
dataObject = {
id:dataObject.id,
@jeanmachuca
jeanmachuca / index.html
Created January 26, 2019 03:28
QCObjects Sample
<!doctype html>
<html class="no-js" lang="en">
<body>
<container id="contentLoader" ></container>
</body>
</html>