Skip to content

Instantly share code, notes, and snippets.

View selvinortiz's full-sized avatar
👋

Selvin Ortiz selvinortiz

👋
View GitHub Profile
@selvinortiz
selvinortiz / craftrecord.php
Last active December 24, 2015 15:29
Craft:Record:getInstance
<?php
namespace Craft;
class Plugin_BaseRecord extends BaseRecord
{
public static function getInstance(BaseModel $model=null)
{
$record = get_called_class();
$record = new $record;
@selvinortiz
selvinortiz / craftplugintesting.md
Last active September 13, 2018 18:23
Unit Testing for Craft Plugins

Unit Testing for Craft Plugins

Writing unit tests for your craft plugin has not been straight forward out of the gate but P&T is taking steps to fully integrate unit testing and have already added the basic necessities to do so.

Assumed Directory Structure


@craft = /path/to/site/craft
@craftTests = @craft/app/tests
<?php
namespace Craft;
class MyPluginService extends BaseApplicationComponent
{
const DEFAULT_TEMPLATES_PATH = 'path/to/templates/';
/**
* Renders a template in a custom location defined by $path
*
Verifying that +selvinortiz is my blockchain ID. https://onename.com/selvinortiz
@selvinortiz
selvinortiz / app.js
Created July 31, 2016 05:39 — forked from sogko/app.js
gulp + expressjs + nodemon + browser-sync
'use strict';
// simple express server
var express = require('express');
var app = express();
var router = express.Router();
app.use(express.static('public'));
app.get('/', function(req, res) {
res.sendfile('./public/index.html');
@selvinortiz
selvinortiz / main.rs
Last active November 28, 2022 05:58
Read PNG files as variants into a trait and add those traits to the collection to prepare layers for the next step in generating NFTs
use std::convert::AsRef;
use std::io::Result;
use std::path::{Path, PathBuf};
#[derive(Debug)]
struct Trait {
name: String,
variants: Vec<String>,
}
@selvinortiz
selvinortiz / AITool.md
Created March 5, 2024 18:31 — forked from localzet/AITool.md
AI Tool Master List