Skip to content

Instantly share code, notes, and snippets.

View jasonknight's full-sized avatar

Jason Martin jasonknight

View GitHub Profile
<?php
function listing_post_type() {
$labels = array(
'name' => _x( 'Listing', 'Post Type studio', 'text_domain' ),
'singular_name' => _x( 'Listing', 'Post Type studio', 'text_domain' ),
'menu_name' => __( 'Listings', 'text_domain' ),
'parent_item_colon' => __( 'Parent Listing:', 'text_domain' ),
'all_items' => __( 'All Listings', 'text_domain' ),
'view_item' => __( 'View Listing', 'text_domain' ),
'add_new_item' => __( 'Add New Listing', 'text_domain' ),
program simple
implicit none
real a
real b
write(*,fmt='(a)',advance='no') 'Set a to: '
read*, a
write(*,fmt='(a)',advance='no') 'Set b to: '
read*, b
write(*,*) 'sq(a)=',sq(a),'sq(b)=',sq(b)
write(*,*) 'average(a,b)=',average(a,b)
@jasonknight
jasonknight / IniLoader.cs
Last active April 1, 2020 21:57
C# Ini File Loader for Unity3d
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Text;
using UnityEngine;
public class IniLoader {
public string data;
public int position;
public void load(string path) {
function renderPost(post) {
// some rendering logic
if ( getAdminEmails(users).indexOf(current_user.email) != -1 ) {
renderAdminControls(post);
}
}
$.getJSON('/posts',function (posts) {
posts.forEach( function (post) {
renderPost(post);
});
var user_data = {
admin_users: [
{
role: 'admin',
email: 'fakeadmin1@email.com'
},
{
role: 'admin',
email: 'fakeadmin2@email.com'
},
var users = [
{
role: 'admin',
email: 'fakeadmin1@email.com'
},
{
role: 'user',
email: 'fake2@email.com'
},
{
var users = [
{
role: 'admin',
email: 'fakeadmin1@email.com'
},
{
role: 'user',
email: 'fake2@email.com'
},
{
@jasonknight
jasonknight / Introduction
Created November 3, 2019 22:43
0_Introduction.md
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>0_Introduction.md</title>
<link rel="stylesheet" href="https://stackedit.io/style.css" />
</head>
@jasonknight
jasonknight / linked_list_stack.rb
Last active July 31, 2019 21:29
Reversing a linked list with a stack
class Node
attr_accessor :value,:next_node
def initialize(val,nxt)
@value = val
@next_node = nxt
end
end
class Stack
attr_accessor :data
def initialize(d=nil)
@jasonknight
jasonknight / blur_1_2_3.rb
Last active July 29, 2019 18:06
Trilogy Challenge: Blur Image
class Image
def initialize(data)
@data = data
end
def get_image()
return @data.collect {|row| row.join("") }.join("\n")
end
def blur(dist=1)
new_data = @data.map do |r|
r.map do |c|