Instantly share code, notes, and snippets.

View webdev_online_resources.md
View apdate.js
function apDate(date) {
var months = ['Jan.', 'Feb.', 'March', 'April', 'May', 'June', 'July', 'Aug.', 'Sept.', 'Oct.', 'Nov.', 'Dec.'];
return months[date.getMonth()] + ' ' + date.getDate() + ', ' + date.getFullYear();
}
View mastodon-ui-suckiness-vacuum.css
/* This will probably do things you don't want, sorry
Look for some other Pro Tips in the comments for how to make it better for you
*/
* {
/* Fuck animations */
animation: none ;
/* Fuck LARGE CAPITAL LETTERS */
text-transform: none ;
/* Fuck more animations */
transition-property: none ;
View doc.md

How to invert mouse wheel to NaturalScrolling in Linux for Raspberry Pi

Via the Terminal, type the following

cd /usr/share/X11/xorg.conf.d
sudo nano 40-libinput.conf

Add to following line to the BOTTOM of the FIRST Section "InputClass"

View gist:3002458
# From http://garmoncheg.blogspot.com/2012/06/pretty-git-log.html
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --"
View ruby_meta.md

#!/bin/ruby --verion => 2.0.0-p353

Self

In Ruby, self is a special variable that always references the current object.

  • Inside class or module definition, self refer to the Class or Module object.
  • Inside instance method, self refer to future instance object.
  • Inside class method, self refer to the class.i
View readme.md

Conventions

  • A = [xA, yA] is a point on the 2D plane. Same for B, C, ...
  • lengths are in any unit (ex: pixels)
  • code snippets are in JavaScript

Degrees to radians

angleRad = angleDeg * Math.PI / 180;

View InstallOpenCV.md

Building OpenCV 3.2.0 from source with Python 3 support

Install OpenCV on macOS Sierra enabling Python 3 with the following instructions:

  • Install CMake, Python 3 + Numpy in advance
  • Download latest OpenCV source code (https://github.com/opencv/opencv/releases)
  • Move the folder opencv-3.2.0 to the current directory
  • In the current directory, execute the following steps:
mkdir build
View tcno.js
tcno(value) {
value = String(value);
// T.C. identity number should have 11 digits and first should be non-zero.
if (!(/^[1-9]\d{10}$/).test(value)) return false;
var digits = value.split(''),
// store last 2 digits (10th and 11th) which are actually used for validation
d10 = Number(digits[9]),
d11 = Number(digits[10]),
// we'll also need the sum of first 10 digits for validation
sumOf10 = 0,
View gist:5469009
type T struct {
A int
B string
}
t := T{23, "skidoo"}
s := reflect.ValueOf(&t).Elem()
typeOfT := s.Type()
for i := 0; i < s.NumField(); i++ {