Skip to content

Instantly share code, notes, and snippets.

View Sun-Wukong's full-sized avatar

Jason Sun-Wukong

  • Dirty Jersey
View GitHub Profile
@Sun-Wukong
Sun-Wukong / gist:30209f0fdfb9cd773cd5
Last active December 2, 2015 03:07 — forked from CharlesBdope/gist:a05b891acf92b700b43e
Stuffy, stuff for c++ class
// Example program
#include <iostream>
#include <iomanip>
using namespace std;
int main ()
{
const double COST_PER_CUBIC_FOOT = 0.23;
const double CHARGE_PER_CUBIC_FOOT = 0.5;
@Sun-Wukong
Sun-Wukong / algorithms.js
Last active January 18, 2016 02:43
Examples of fundamental features of Javascript (ES5)
//TODO: clean up after checking for accuracy
/* Returns either the index of the location in the array,
or -1 if the array did not contain the targetValue */
var doSearch = function(array, targetValue) {
var min = 0;
var max = array.length - 1;
var guess;
for( var i = 0; var i >= max; i++ ) {
guess = ( min + max ) / 2;
@Sun-Wukong
Sun-Wukong / VariableBreakdown.py
Last active February 16, 2016 14:40
Mini repo showcasing Python features
""" A brief breakdown of how variables and assignments work in Python through example.
Check out Chapter 4 of 'Learning Python, 4th Edition' """
# To start, variables serve as a way to identify data objects in Python
# Kinda like a nametag identifies people on the job
# Below is an example of such The format is [variable name] ( applies to [ aka: = ] ) [data object value]
one = 1 # the name "one" is applied to an object with the value of 1
one = 2 # now, a new object holding a value of 2 is created. one is applied to the new object
one = 1 # so, when we originally switched assignment values: our object valued at 1 was in limbo, waiting to die a la GC
@Sun-Wukong
Sun-Wukong / LinqSnips.cs
Created May 22, 2015 03:17
Getting Familiar with LINQ fundamentals... will add more snips as I learn
/*
Summary: Brief demo of linq queries implemented in C#
Disclaimer: This barely scratches the surface of LINQ
I'd suggest looking at ASP.NET Development to get a
more "Real life" taste for LINQ
*/
[Description("This sample uses the where clause to find all customers in Washington " +
"and then it uses a foreach loop to iterate over the orders collection that belongs to each customer.")]
public void Linq4()
{
@Sun-Wukong
Sun-Wukong / Course.cs
Created May 13, 2015 16:29
Problem Set 7 for DEV204x: Demonstrating Collections s/n: This is a slight mod of pset6
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace pset6JCS
{
@Sun-Wukong
Sun-Wukong / Course.cs
Created May 12, 2015 15:33
Problem Set 6 for DEV204x
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace pset6JCS
{
class Course
{
@Sun-Wukong
Sun-Wukong / Aeroplane.cs
Created May 12, 2015 00:31
Inheritance / Polymorphism demos
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace pset6JCS
{
class Aeroplane : Vehicle
{
@Sun-Wukong
Sun-Wukong / GCDemo.cs
Created May 11, 2015 20:28
Garbage Collector demo for reference
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace pset6JCS
{
class Calculator : IDisposable
{
@Sun-Wukong
Sun-Wukong / Course.cs
Last active August 29, 2015 14:20
Files for DEV204x Problem Set 5
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace pset5JCS
{
class Course
{
@Sun-Wukong
Sun-Wukong / http_async_juggling.js
Last active August 29, 2015 14:15
Me floundering through @rvagg/learnyounode challenges, take a look if you got stuck
var http = require( 'http' );
var bl = require( 'bl' );
var my_url = process.argv[2];
var responses = [];
function print_the_stuff() {
for( var i = 0; i < responses.length; i++ ) {
console.log( responses[ i ] );
}
}