Skip to content

Instantly share code, notes, and snippets.

module Component
def operation
raise "Component error"
end
end
module Decorator
include Component
def initialize(component)
module Component
def operation
raise "Component error"
end
end
module Decorator
include Component
def initialize(component)
@component = component
// ==UserScript==
// @name SPM Custom CSS Properties
// @namespace http://tampermonkey.net/
// @version 0.35
// @description SPM UI theme creation using CSS properties
// @author https://github.com/daithimorton
// @match https://*/*
// @match http://*/*
// @grant none
// @downloadUrl https://gist.github.com/daithimorton/467336d64f1a130ef622499634dd098c/raw/spmcssvar.user.js
@uxdxdev
uxdxdev / panda.py
Created December 21, 2016 15:15
Panda3D Moonwalking Panda Source Code
from math import pi, sin, cos
from direct.showbase.ShowBase import ShowBase
from direct.task import Task
from direct.actor.Actor import Actor
from direct.interval.IntervalGlobal import *
from panda3d.core import Point3
class MyApp(ShowBase):
@uxdxdev
uxdxdev / json_parser.txt
Created December 21, 2016 15:11
RapdiJson writing json data to file example C++
#include <fstream>
#include "external/json/stringbuffer.h"
#include "external/json/writer.h"
void JsonParser::JsonToFile(rapidjson::Document &jsonObject, std::string &fullpath) {
std::ofstream outputFile;
outputFile.open(fullpath);
if(outputFile.is_open()) {
std::string jsonObjectData = JsonToString(jsonObject);
outputFile << jsonObjectData;
void Cannon::Update(float dt)
{
if (m_pTarget != nullptr && m_pSprite != nullptr)
{
cocos2d::Vec2 thisPosition;
thisPosition = m_pSprite->getPosition();
m_TargetPosition = WorldManager::getInstance()->GetCenter(m_pTarget);
float angle = atan2(thisPosition.x - m_TargetPosition.x, thisPosition.y - m_TargetPosition.y);
@uxdxdev
uxdxdev / Parity.cpp
Last active January 27, 2023 16:46
EPI C++ 5.1 Computing the parity of a word
#include <iostream>
#include <sstream>
#include <map>
using namespace std;
std::map<unsigned int, short> parityCache;
short parityOf(unsigned long x){
short result = 0;
while(x){
@uxdxdev
uxdxdev / Utils.h
Created January 7, 2017 15:32
Utils class
// Copyright 2016 David Morton. All rights reserved.
// Use of this source code is governed by a license that can be
// found in the LICENSE file.
#ifndef BASE_UTILS_H
#define BASE_UTILS_H
#include <iostream>
class Utils {
@uxdxdev
uxdxdev / UtilsTest.cpp
Last active January 27, 2023 16:47
Unit tests for Utils class
// Copyright 2016 David Morton. All rights reserved.
// Use of this source code is governed by a license that can be
// found in the LICENSE file.
#include "gtest/gtest.h"
#include "Base/Utils.h"
TEST(UtilsTest, to_strCanConvertIntZeroToString) {
std::string result = Utils::to_str(0);
ASSERT_EQ("0", result);
// Receiver
class Entity {
String name;
public Entity(String name){
this.name = name;
}
public void jump(){
System.out.println(name + " Jump");
}
public void fire(){