Skip to content

Instantly share code, notes, and snippets.

View awave1's full-sized avatar

Artem Golovin awave1

  • Vancouver, Canada
  • 13:35 (UTC -07:00)
View GitHub Profile
@bert
bert / README
Created July 15, 2011 21:01
Bresenham Algorithms in C
Some possible implementations of the Bresenham Algorithms in C.
The Bresenham line algorithm is an algorithm which determines which points in an
n-dimensional raster should be plotted in order to form a close approximation
to a straight line between two given points.
It is commonly used to draw lines on a computer screen, as it uses only integer
addition, subtraction and bit shifting, all of which are very cheap operations
in standard computer architectures.
It is one of the earliest algorithms developed in the field of computer graphics.
A minor extension to the original algorithm also deals with drawing circles.
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 1, 2024 03:34
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@bellbind
bellbind / app.m
Created July 19, 2012 20:32
[macosx][objective-c]Make cocoa app without Xcode
// clang -framework Cocoa app.m -o app
// ./app
#import <Cocoa/Cocoa.h>
int main()
{
[NSAutoreleasePool new];
id app = [NSApplication sharedApplication];
[app setActivationPolicy:NSApplicationActivationPolicyRegular];
@phillbaker
phillbaker / lmu.m
Created November 17, 2012 20:23
Macbook ambient light sensor data
// Compile with $ gcc -o lmutracker lmu.m -framework IOKit -framework CoreFoundation -framework Foundation
// Usage: ./lmu [now]
// Prints out the value from the ambient light sensor and the back light LED every 1/10 of a second. Optionally print just one value.
// Inspired by the code found at
// http://google-mac-qtz-patches.googlecode.com/svn-history/r5/trunk/AmbientLightSensor
// and http://osxbook.com/book/bonus/chapter10/light/
// and http://en.wikipedia.org/wiki/Wikipedia:Reference_desk/Archives/Computing/2010_February_10#Mac_OS_X_keyboard_backlight_drivers
// http://forums.macrumors.com/showthread.php?t=1133446
#include <stdio.h>
@rosswd
rosswd / multi-git-win.md
Last active February 28, 2024 09:46
Setting up a Github and Bitbucket account on the same computer on Mac OS. Now with a guide for Windows 10.

Setting up github and bitbucket on the same computer (Windows)

Guide for Windows

mix3d asked for some help using this guide with windows so here we go. This was tested with Windows 10. Run all commands in Git Bash once it's installed.

Github will be the main account and bitbucket the secondary.

Git for Windows

  • Download and install Git for Windows
    • In the installer, select everything but decide if you want a desktop icon (2nd step)
@simonista
simonista / .vimrc
Last active May 1, 2024 19:47
A basic .vimrc file that will serve as a good template on which to build.
" Don't try to be vi compatible
set nocompatible
" Helps force plugins to load correctly when it is turned back on below
filetype off
" TODO: Load plugins here (pathogen or vundle)
" Turn on syntax highlighting
syntax on
@staltz
staltz / introrx.md
Last active May 2, 2024 12:31
The introduction to Reactive Programming you've been missing
@sogko
sogko / app.js
Last active November 8, 2022 12:31
gulp + expressjs + nodemon + browser-sync
'use strict';
// simple express server
var express = require('express');
var app = express();
var router = express.Router();
app.use(express.static('public'));
app.get('/', function(req, res) {
res.sendfile('./public/index.html');
@Shywim
Shywim / CursorRecyclerAdapter.java
Last active February 27, 2024 13:42
A custom Adapter for the new RecyclerView, behaving like the CursorAdapter class from previous ListView and alike. Now with Filters and updated doc.
/*
* The MIT License (MIT)
*
* Copyright (c) 2014 Matthieu Harlé
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@nolanlawson
nolanlawson / protips.js
Last active February 4, 2024 18:06
Promise protips - stuff I wish I had known when I started with Promises
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");