Skip to content

Instantly share code, notes, and snippets.

View hamidb80's full-sized avatar
⚰️
What have you done for Palestine? Hope it is not silence

O God please eliminate Israel hamidb80

⚰️
What have you done for Palestine? Hope it is not silence
View GitHub Profile
@linusthe3rd
linusthe3rd / circles.cpp
Created January 30, 2011 18:54
The two methods used to create circles in opengl
/*
* Function that handles the drawing of a circle using the triangle fan
* method. This will create a filled circle.
*
* Params:
* x (GLFloat) - the x position of the center point of the circle
* y (GLFloat) - the y position of the center point of the circle
* radius (GLFloat) - the radius that the painted circle will have
*/
void drawFilledCircle(GLfloat x, GLfloat y, GLfloat radius){
@chrisjacob
chrisjacob / README.md
Created February 18, 2011 03:44
Setup GitHub Pages "gh-pages" branch and "master" branch as subfolders of a parent project folder ("grandmaster").

Intro

Description: Setup GitHub Pages "gh-pages" branch and "master" branch as subfolders of a parent project folder ("grandmaster").

Author: Chris Jacob @_chrisjacob

Tutorial (Gist): https://gist.github.com/833223

The Result

@ivanyu
ivanyu / matrix_fib.py
Last active January 18, 2023 20:33
Fibonacci number in O( log N ) operations.
import time
import random
class MatrixFibonacci:
A = [[1, 1],
[1, 0]]
def __init__(self):
self.__memo = {}
@hak8or
hak8or / SHA_256_hak.cpp
Created February 3, 2014 23:12
SHA-256 basic implementation in C++ with a test.
#include <iostream>
#include <sstream>
#include <bitset>
#include <vector>
#include <iomanip>
#include <cstring>
// By: hak8or
// To compile: g++ -std=c++0x SHA_256_hak.cpp -o SHA_256_hak
// To run self test just run the following: SHA_256_hak
@davidthingsaker
davidthingsaker / responsive mixin
Created September 24, 2014 16:13
SCSS / Sass mixin for responsive sites
$small-desktop: 960px;
$large-desktop: 1200px;
$handheld: 768px;
$handhelds-landscape: 1024px;
$mobile: 640px;
$mobile-landscape: 480px;
@mixin respond-to($media) {
@if $media == largeDesktop {
@media only screen and (min-width: $large-desktop) { @content }
@wachunei
wachunei / numeric_for_django_templates.html
Last active October 27, 2022 13:41
Numeric for loop in Django Templates
<!-- Iterate N times (replace N with a number -->
{% for i in "x"|ljust:"N" %}
<!-- Access numeric variable (0-based index) -->
{{ forloop.counter0 }}
<!-- Access numeric variable (1-based index) -->
{{ forloop.counter }}
{% endfor %}
<!-- For example, iterate from 0 to 3 -->
@CMCDragonkai
CMCDragonkai / regular_expression_engine_comparison.md
Last active July 12, 2024 00:49
Regular Expression Engine Comparison Chart

Regular Expression Engine Comparison Chart

Many different applications claim to support regular expressions. But what does that even mean?

Well there are lots of different regular expression engines, and they all have different feature sets and different time-space efficiencies.

The information here is just copied from: http://regular-expressions.mobi/refflavors.html

@wojteklu
wojteklu / clean_code.md
Last active July 23, 2024 07:47
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@reborg
reborg / rich-already-answered-that.md
Last active July 11, 2024 09:54
A curated collection of answers that Rich gave throughout the history of Clojure

Rich Already Answered That!

A list of commonly asked questions, design decisions, reasons why Clojure is the way it is as they were answered directly by Rich (even when from many years ago, those answers are pretty much valid today!). Feel free to point friends and colleagues here next time they ask (again). Answers are pasted verbatim (I've made small adjustments for readibility, but never changed a sentence) from mailing lists, articles, chats.

How to use:

  • The link in the table of content jumps at the copy of the answer on this page.
  • The link on the answer itself points back at the original post.

Table of Content

@rsirres
rsirres / await_example.nim
Created March 24, 2017 21:38
Nimlang Nim await example
import os, asyncnet, asyncdispatch
proc callback1(): Future[int] =
var retFuture = newFuture[int]("callback1")
echo "Callback1: Waiting"
sleep(3000)
retFuture.complete(10)
return retFuture