Skip to content

Instantly share code, notes, and snippets.

View EliCDavis's full-sized avatar
👹
In another reality

Eli Davis EliCDavis

👹
In another reality
View GitHub Profile
@mre
mre / bitonic_sort.cu
Last active March 17, 2024 15:47
Bitonic Sort on CUDA. On a quick benchmark it was 10x faster than the CPU version.
/*
* Parallel bitonic sort using CUDA.
* Compile with
* nvcc -arch=sm_11 bitonic_sort.cu
* Based on http://www.tools-of-computing.com/tc/CS/Sorts/bitonic_sort.htm
* License: BSD 3
*/
#include <stdlib.h>
#include <stdio.h>
@ebidel
ebidel / handle_file_upload.php
Created April 18, 2012 03:23
Uploading files using xhr.send(FormData) to PHP server
<?php
$fileName = $_FILES['afile']['name'];
$fileType = $_FILES['afile']['type'];
$fileContent = file_get_contents($_FILES['afile']['tmp_name']);
$dataUrl = 'data:' . $fileType . ';base64,' . base64_encode($fileContent);
$json = json_encode(array(
'name' => $fileName,
'type' => $fileType,
'dataUrl' => $dataUrl,
@drawcode
drawcode / WebWindow.cs
Created January 22, 2013 18:11
Unity WebWindow (browser within unity editor window, helpful for tools that require a web view or more beyond basic controls).
using UnityEngine;
using UnityEditor;
using System;
using System.Reflection;
public class WebWindow : EditorWindow {
static Rect windowRect = new Rect(100,100,800,600);
static BindingFlags fullBinding = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static;
static StringComparison ignoreCase = StringComparison.CurrentCultureIgnoreCase;
@jamiees2
jamiees2 / astar.py
Created May 7, 2013 11:20
A* Algorithm implementation in python.
# Enter your code here. Read input from STDIN. Print output to STDOUT
class Node:
def __init__(self,value,point):
self.value = value
self.point = point
self.parent = None
self.H = 0
self.G = 0
def move_cost(self,other):
return 0 if self.value == '.' else 1
@kenshinx
kenshinx / client.go
Last active February 3, 2024 18:49
golang socket server & client ping-pong demo
package main
import (
"os"
"log"
"net"
"strconv"
"strings"
)
@Sigmus
Sigmus / gulpfile.js
Last active November 15, 2017 11:55
gulpfile.js with browserify, reactify, watchify and gulp-notify.
var source = require('vinyl-source-stream');
var gulp = require('gulp');
var gutil = require('gulp-util');
var browserify = require('browserify');
var reactify = require('reactify');
var watchify = require('watchify');
var notify = require("gulp-notify");
var scriptsDir = './scripts';
var buildDir = './build';
@demisx
demisx / angularjs-providers-explained.md
Last active March 17, 2024 11:09
AngularJS Providers: Constant/Value/Service/Factory/Decorator/Provider
Provider Singleton Instantiable Configurable
Constant Yes No No
Value Yes No No
Service Yes No No
Factory Yes Yes No
Decorator Yes No? No
Provider Yes Yes Yes

Constant

@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active April 20, 2024 16:52
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\

@staltz
staltz / introrx.md
Last active May 3, 2024 13:00
The introduction to Reactive Programming you've been missing
@blixt
blixt / prng.js
Last active January 14, 2024 07:01
A very simple, seedable JavaScript PRNG. NOTE: Please read comments on why this is not a good choice.
// NOTICE 2020-04-18
// Please see the comments below about why this is not a great PRNG.
// Read summary by @bryc here:
// https://github.com/bryc/code/blob/master/jshash/PRNGs.md
// Have a look at js-arbit which uses Alea:
// https://github.com/blixt/js-arbit
/**