Skip to content

Instantly share code, notes, and snippets.

@Darth-Knoppix
Darth-Knoppix / index.html
Last active July 29, 2022 05:31
HTLML5.1 Context Menu
<!-- A <div> element with a context menu -->
<div contextmenu="contact-menu">
John Smith | ABC Company
</div>
<menu type="context" id="contact-menu">
<menuitem>Email</menuitem>
<menuitem>Send Message</menuitem>
<hr>

Typography

Headings

Headings from H1 to H6 are constructed with a # for each level.

# H1 Heading
## H2 Heading
### H3 Heading
@kkabdol
kkabdol / three_snippets.js
Last active July 27, 2022 01:27
Code snippets for three.js
// how to load a texture
var texture = THREE.ImageUtils.loadTexture( '/media/img/cs291/textures/grass512x512.jpg' );
texture.wrapS = texture.wrapT = THREE.RepeatWrapping;
texture.repeat.set( 10, 10 );
var solidGround = new THREE.Mesh(
new THREE.PlaneGeometry( 10000, 10000, 100, 100 ),
new THREE.MeshLambertMaterial( { map: texture } ) );
var texture = THREE.ImageUtils.loadTexture( '/media/img/cs291/textures/feather.png' );
var tail = new THREE.Mesh(
@zer0id0
zer0id0 / abbr.css
Last active July 20, 2022 07:04
Bootstrap and emmet
#myElement{
color: #000;
color: #000;
color: #f4f4f4;
position: absolute;
position: relative;
position: fixed;
position: static;
@devmao
devmao / components.my-child-component.js
Last active August 18, 2022 17:22
Conditional Child Components
import Ember from 'ember';
import hbs from 'htmlbars-inline-precompile';
export default Ember.Component.extend({
layout: hbs`
<h4>Child Component {{_index}}</h4>
{{#if _firstChild}}
I'm the FIRST!
{{else}}
@garmjs
garmjs / helpers.js
Created November 12, 2017 22:25
AST Helpers
function findParent(node, test) {
if (test(node)) {
return node
} else if (node.parent) {
return findParent(node.parent, test)
}
return null
}
function looksLike(a, b) {
import Ember from 'ember';
const MAX_CHATLOG_LINES = 15;
export default Ember.Component.extend({
chatService: Ember.inject.service(),
truncatedChatLog: Ember.computed('chatService.chatLog.[]', function() {
const chatLog = this.get('chatService.chatLog');
return chatLog.slice(Math.max(0, chatLog.length - MAX_CHATLOG_LINES));
@kefavn
kefavn / components.chat-component.js
Last active July 26, 2022 16:56
Game Example 2
import Ember from 'ember';
const MAX_CHATLOG_LINES = 15;
export default Ember.Component.extend({
chatState: 'battle',
showingBattleLog: Ember.computed.equal('chatState', 'battle'),
showingChatLog: Ember.computed.equal('chatState', 'chat'),
import Ember from 'ember';
function clamp(min, val, max) {
return Math.max(min, Math.min(val, max));
};
export default Ember.Component.extend({
classNames: ['container'],
_scrollTo: 0,
@kefavn
kefavn / components.tileset-component.js
Last active July 26, 2022 16:54
Tiling (movable) 4
import Ember from 'ember';
const TILE_MAP = {
'....': 'none',
'᎘1᎘': 'baseTop1',
'᎘2᎘': 'baseTop2',
'᎘3᎘': 'baseTop3',
'᎘4᎘': 'baseTop4',
'᎘5᎘': 'baseTop5',
'᎘6᎘': 'baseTop6',