Skip to content

Instantly share code, notes, and snippets.

View LucienLee's full-sized avatar
🦌

Lucien Lee LucienLee

🦌
View GitHub Profile
function appendFb( data, userID ){
var frag = document.createDocumentFragment();
var times = 0;
for (var i = 0, max = 40; i < max ; i++) {
var friend = data[i];
$.ajax({
url: 'https://graph.facebook.com/fql?q=SELECT friend_count FROM user WHERE uid='+ friend.id,
error: function( error ){
var data = "exports = module.exports = {
room1: 'public',
room2: 'public',
room3: 'public'
};"
var f = new Function('var module={},exports=null;\n'+data+'\nif(typeof module.exports !== "undefined") {\nreturn module.exports;\n}\nif(null != exports) {\n return exports;\n}');
var exports = f();
@LucienLee
LucienLee / gist:5910989
Created July 2, 2013 16:47
php array with array and something else
<?php
$v = array('a', 'b',
array('c', 'd' )
,array('e', 'f'));
foreach ($v as $values)
{
if(is_array($values)){
foreach ($values as $value)
{
@LucienLee
LucienLee / joystick
Last active December 17, 2019 14:26
Sanwa joystick on Arduino example code
//A0 = green, A1 = yellow, A2 = orange, A3 = red
#define downPin 14
#define upPin 15
#define rightPin 16
#define leftPin 17
void setup() {
Serial.begin(9600);
@LucienLee
LucienLee / gist:058964d07f081080dc33
Last active August 29, 2015 14:08
list example
var $list = $('ul');
// make an <li> element
var makeItem = function(text){
var $li = $('<li><input type="text"><span></span></li>');
if(text){
$li.find('input').val(text);
$li.find('span').text(text);
}
return $li;
using UnityEngine;
using System.Collections;
public class ThirdPersonController : MonoBehaviour {
public GameObject player;
public GameObject mainCamera;
public GameObject cameraCollisionBox;
public CollisionCounter cameraProbe;
using UnityEngine;
using System.Collections;
public class ThirdPersonController : MonoBehaviour {
public GameObject player;
public GameObject mainCamera;
public GameObject cameraCollisionBox;
public CollisionCounter cameraProbe;
public CollisionCounter probe;
using UnityEngine;
using System.Collections;
public class ThirdPersonController : MonoBehaviour {
public GameObject player;
public GameObject mainCamera;
public GameObject cameraCollisionBox;
public CollisionCounter probe;
public CollisionCounter cameraProbe;
// Open Script Editor and Export this as an Application
//
// Then drop a keynote file on it in the Finder and it will properly resize
// and rotate everything so the Keynote file becomes usable as a prototype
// in the iPhone keynote app
// rotateDocument exported function
//
// Accepts a Keynote document and will rotate
// all the slides and elements in the slide 90 degrees
@LucienLee
LucienLee / parser.js
Created March 15, 2017 15:02
JsonParser
function JsonParser() {}
JsonParser.prototype.parse = function(inputStr) {
let trimmed = inputStr.replace(/ /g, '')
if (isArray(trimmed)) {
return parseArray(trimmed)
} else if (isObject(trimmed)) {
return parseObj(trimmed)
}
}