Skip to content

Instantly share code, notes, and snippets.

View jweinst1's full-sized avatar
🎯
Focusing

Josh Weinstein jweinst1

🎯
Focusing
View GitHub Profile
@jessedc
jessedc / compiled.html
Created April 25, 2011 12:19
Jade Example for Steve
<html lang="en">
<head>
<title>
title of the page
</title>
<link rel="stylesheet" type="text/css" href="/stylesheets/style.css">
</head>
<body>
<h1>
title of the post
@fracek
fracek / CMakeLists.txt
Last active June 22, 2024 21:33
CMake and GTK+ 3
# Thanks to @danger89 and @Ilothar for updating the gist.
# Set the name and the supported language of the project
project(hello-world C CXX)
# Set the minimum version of cmake required to build this project
cmake_minimum_required(VERSION 3.10)
# Use the package PkgConfig to detect GTK+ headers/library files
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK REQUIRED gtkmm-3.0)
@asanoboy
asanoboy / makewav.js
Created October 30, 2012 11:39
How to make a WAV file in Javascript.
var Wav = function(opt_params){
/**
* @private
*/
this._sampleRate = opt_params && opt_params.sampleRate ? opt_params.sampleRate : 44100;
/**
* @private
*/
@niw
niw / libpng_test.c
Last active June 19, 2024 10:32
How to read and write PNG file using libpng. Covers trivial method calls like png_set_filler.
/*
* A simple libpng example program
* http://zarb.org/~gc/html/libpng.html
*
* Modified by Yoshimasa Niwa to make it much simpler
* and support all defined color_type.
*
* To build, use the next instruction on OS X.
* $ brew install libpng
* $ clang -lz -lpng16 libpng_test.c
@JustonDavies
JustonDavies / json_tests.c
Created September 25, 2013 15:35
C string realloc and concat
char * strautocat(char **buffer, const char *str1) //char **buffer, const char *format, vargs? Ive done this before
{
assert(str1 != NULL); assert(buffer != NULL);
if(*buffer == NULL){*buffer = (char *)calloc(sizeof(char)*DEFAULT_STRING_LENGTH,sizeof(char));}
size_t allocated_size, required_size;
allocated_size = malloc_usable_size(*buffer);
required_size = strlen(str1)+strlen(*buffer)+1;
while(required_size > allocated_size)
@mb0017
mb0017 / Python-Quicksort.py
Created January 15, 2014 21:46
Quicksort using list comprehensions
#source: http://en.literateprograms.org/Quicksort_(Python)
def qsort1(list):
"""Quicksort using list comprehensions"""
if list == []:
return []
else:
pivot = list[0]
lesser = qsort1([x for x in list[1:] if x < pivot])
greater = qsort1([x for x in list[1:] if x >= pivot])
return lesser + [pivot] + greater
package eval
import scala.reflect.runtime.currentMirror
import scala.tools.reflect.ToolBox
import java.io.File
object Eval {
def apply[A](string: String): A = {
val toolbox = currentMirror.mkToolBox()
@staltz
staltz / introrx.md
Last active July 29, 2024 05:55
The introduction to Reactive Programming you've been missing
@jweinst1
jweinst1 / Node implementation in Swift
Created July 16, 2015 02:10
A class that acts an implementation of a tree node in Swift
class Nodes {
init(data:Int, next_node:Int) {
var data = data
var next_node = next_node
}
func GetData() ->Int {
return Nodes.data
}
func GetNext() ->Int {
return Nodes.next_node
@chausies
chausies / youtube_history.py
Last active August 29, 2015 14:27
This python script gets all of your youtube viewing history into a convenient text file.
#---------------------------------------------------------------#
# This script manually goes through youtube and collects all #
# of your viewing history into a convenient text file. This #
# might take about 30min to an hour, depending on your #
# computer's RAM, processing speed, and internet connection. #
# Note that this program requires the splinter module to work. #
# Run 'pip install splinter' to get it. #
#---------------------------------------------------------------#
print "Making sure you're not using python 3..."
from splinter import Browser