Skip to content

Instantly share code, notes, and snippets.

looping looping84

Block or report user

Report or block looping84

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View highlight.js
function highlightWord(root, word, className) {
// base on https://stackoverflow.com/a/10730063
// word is lower-case
var walker, textNodes = [];
walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, {
acceptNode: function (node) {
if (node.nodeType === Node.TEXT_NODE && node.textContent.toLowerCase().indexOf(word) >= 0) {
return NodeFilter.FILTER_ACCEPT;
} else {
@looping84
looping84 / example.lua
Created Jul 3, 2017 — forked from mebens/example.lua
Doubly linked list in Lua
View example.lua
require("list")
local a = { 3 }
local b = { 4 }
local l = list({ 2 }, a, b, { 5 })
l:pop()
l:shift()
l:push({ 6 })
l:unshift({ 7 })
@looping84
looping84 / BehaviorTree.lua
Created Jun 29, 2017 — forked from mrunderhill89/BehaviorTree.lua
Behavior Tree implementation in Lua.
View BehaviorTree.lua
--[[
This behavior tree code was taken from our Zelda AI project for CMPS 148 at UCSC.
It is for the most part unmodified, and comments are available for each function.
Author: Kevin Cameron (mrunderhill89)
]]--
BT = {}
BT.__index = BT
BT.results = {success = "success"
,fail = "fail"
@looping84
looping84 / 24.md
Created Feb 24, 2017 — forked from bradoyler/24.md
The 24 game in javascript
View 24.md

The 24 Game

  • tests one's mental arithmetic.

How it works:

  • You are randomly given four digits, each from one to nine, with repetitions allowed.
  • The goal is to enter an expression that evaluates to 24
Tips:
  • Only multiplication, division, addition, and subtraction operators/functions are allowed.
  • Division should use floating point or rational arithmetic, etc, to preserve remainders.
View rAF.js
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
You can’t perform that action at this time.