This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::convert::AsRef; | |
use std::io::Result; | |
use std::path::{Path, PathBuf}; | |
#[derive(Debug)] | |
struct Trait { | |
name: String, | |
variants: Vec<String>, | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Verifying that +selvinortiz is my blockchain ID. https://onename.com/selvinortiz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Craft; | |
class MyPluginService extends BaseApplicationComponent | |
{ | |
const DEFAULT_TEMPLATES_PATH = 'path/to/templates/'; | |
/** | |
* Renders a template in a custom location defined by $path | |
* |
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.
@craft = /path/to/site/craft
@craftTests = @craft/app/tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Craft; | |
class Plugin_BaseRecord extends BaseRecord | |
{ | |
public static function getInstance(BaseModel $model=null) | |
{ | |
$record = get_called_class(); | |
$record = new $record; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% extends "_abstract/master.twig" %} | |
{% set bodyId = 'flux' %} | |
{% block content %} | |
{% set url = 'http://www.selvinortiz.com' %} | |
{% | |
set flux = craft.flux | |
.startOfLine() | |
.find('http') | |
.maybe('s') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% extends "_abstract/master.twig" %} | |
{% set title = "Spam Guard" %} | |
{% set bodyId = "spamguard" %} | |
{% block content %} | |
{% if spam is defined %} | |
{% set email = spam.email %} | |
{% set author = spam.author %} | |
{% set content = spam.content %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @=ENV | |
* | |
* @author Selvin Ortiz (http://twitter.com/selvinortiz) | |
* | |
* 1. Define the craft path relative to this file | |
* 2. Define the domain name this site is running under | |
* 3. Define the ip address that requested this resource | |
* 4. Define the environment we are working under |
NewerOlder