Skip to content

Instantly share code, notes, and snippets.



  • Silicon Valley
View GitHub Profile
View CRC32.swift
class CRC32 {
static var table: [UInt32] = {
(0...255).map { i -> UInt32 in
(0..<8).reduce(UInt32(i), { c, _ in
(c % 2 == 0) ? (c >> 1) : (0xEDB88320 ^ (c >> 1))
01GOD / new_gist_file.js
Last active Nov 24, 2016
My Javascript Bubble Sort
View new_gist_file.js
var bubblesort = function(array) {
for (o = 0; o < array.length - 1; o++) {
for (i = 0; i < array.length - 1; i++) {
if (array[i] > array[i + 1]) {
var temp = array[i];
array[i] = array[i + 1];
array[i + 1] = temp;
View new_gist_file_0
// Unity Tutorial Here:
// Sebastian Lague
using UnityEngine;
using System.Collections;
[RequireComponent (typeof (Rigidbody))]
public class GravityBody : MonoBehaviour {
GravityAttractor planet;
View new_gist_file.js
var info = [ 'your enter your text for slide 1 here', 'your enter your text for slide 2 here', 'your enter your text for slide 3 here', 'your enter your text for slide 4 here', 'your enter your text for slide 5 here'  // no comma here - it is the last element of the array. ];   Now you will have to add the code to reach the text in your symbol and this is where it can be tricky, depending what depth it is in. A basic symbol named slide with a text inside named caption would be sym.getSymbol('slide').$('caption').html(info[0]); and it will show element 0 in the array (the first element). The way you call it depends on you. I usually call it the way I showed above on a click event or another kind of event.
01GOD / new_gist_file.js
Created Jan 16, 2015
EA: Set timeout (make a symbol generate after a specified timeout after an event. From
View new_gist_file.js
So far I have this code to set up the setTimeout in the click tab of the stage:   if (playing) {      timerName= setTimeout(function() {      sym.$("buttonName").show();      }, 10000); }
View new_gist_file.js
Swift automatically bridges between the String type and the NSString class. This means that anywhere you use an NSString object, you can use a Swift String type instead and gain the benefits of both types But it appears that only some of NSString's functions are accessible without explicitly bridging. To bridge to an NSString and use any of its functions, the following methods work: //Example Swift String var var newString:String = "this is a string" //Bridging to NSString //1 (newString as NSString).containsString("string") //2 newString.bridgeToObjectiveC().containsString("string") //3 NSString(string: newString).containsString("string") All three of these work. It's interesting to see that only some NSString methods are available to Strings and others need explicit bridging. This may be something that is built upon as Swift develops. share|improve this answer edited Jun 4 '14 at 3:08 answered Jun 3 '14 at 4:56 Jpoliachik 411313 add a comment up vote 2 down vote So wh
01GOD / 0_reuse_code.js
Last active Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
You can’t perform that action at this time.