Skip to content

Instantly share code, notes, and snippets.

@ad8e
ad8e / glfw_ship.cpp
Last active April 20, 2024 21:16
instructions to use skia and glfw together. (download, installation, first program). as of Sept 2023, Windows is broken but this is still sadly the best starting resource for skia on Windows too.
/* Note: this Google copyright notice only applies to the original file, which has large sections copy-pasted here. my changes are under CC0 (public domain).
* Copyright 2015 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/*
The official instructions don't work well. These alternative instructions are intended to be the shortest path to get a minimal setup running.

CoreOS Workstation Notes

This is a summary of the system setup used for the demonstration on 2016-07-18.

Goals / Requirements

This was put together with the following intent:

  • It must build upon an unmodified CoreOS user space image.
@Jarred-Sumner
Jarred-Sumner / comcast.js
Last active September 7, 2022 01:30
Comcast injects this into webpages to show copyright notices
// Comcast Cable Communications, LLC Proprietary. Copyright 2014.
// Intended use is to display browser notifications for critical and time sensitive events.
var _ComcastAlert = (function(){
return {
SYS_URL: '/e8f6b078-0f35-11de-85c5-efc5ef23aa1f/aupm/notify.do'
, dragObj: {zIndex: 999999}
, browser: null
, comcastCheck: 1
, comcastTimer: null
, xmlhttp: null
@gaearon
gaearon / slim-redux.js
Last active May 5, 2024 15:14
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {

Things that programmers don't know but should

(A book that I might eventually write!)

Gary Bernhardt

I imagine each of these chapters being about 2,000 words, making the whole book about the size of a small novel. For comparison, articles in large papers like the New York Times average about 1,200 words. Each topic gets whatever level of detail I can fit into that space. For simple topics, that's a lot of space: I can probably walk through a very basic, but working, implementation of the IP protocol.

"""
This is an example of how to use Hypothesis to test a classic combinatorial
optimisation problem without having a reference implementation to compare
against.
The problem we're going to look at is the knapsack packing problem: Given a
set of objects with value and weight, how can maximize the total value while
keeping the total weight under a certain amount.
You can solve this exactly as an integer linear programming without too much
@thypon
thypon / Extract Deps
Created April 24, 2015 23:56
Extract Deps in Ruby
#!/usr/bin/env ruby
require 'rubygems'
require 'gems'
require 'json'
class Package < Struct.new(:name, :language, :version, :hash, :source, :homepage, :depends)
end
class Dependencies < Struct.new(:hostmake, :make, :runtime)
@romainl
romainl / _rnb.md
Last active August 12, 2021 21:56
RNB, a Vim colorscheme template
@ryane
ryane / five_minutes.yml
Created February 24, 2015 15:15
five_minutes.yml
---
- hosts: all
vars:
UBUNTU_COMMON_ROOT_PASSWORD: 'xxxxx'
UBUNTU_COMMON_DEPLOY_PASSWORD: 'xxxxx'
UBUNTU_COMMON_LOGWATCH_EMAIL: user@example.com
ubuntu_common_deploy_user_name: deploy
ubuntu_common_deploy_public_keys:
- ~/.ssh/id_rsa.pub
@mislav
mislav / fuzzy.coffee
Created January 20, 2015 01:47
Fuzzy scoring algorithm adopted from Selecta as used on GitHub.com
# Get the shortest match (least distance between start and end index) for all
# the query characters in the given text.
#
# Returns an array in format [firstIndex, matchLength, [matchIndexes]]
shortestMatch = (text, queryChars) ->
starts = allIndexesOf(text, queryChars[0])
return if starts.length is 0
return [starts[0], 1, []] if queryChars.length is 1