Skip to content

Instantly share code, notes, and snippets.

View mef51's full-sized avatar

Mohammed Chamma mef51

  • Gaza, Palestine
View GitHub Profile
@mef51
mef51 / randomStuffs.coffee
Created August 30, 2013 14:31
generates pronouncable words
randomInt = (min, max) ->
Math.floor(Math.random() * (max - min + 1) + min)
capitalize = (string) ->
string[0].toUpperCase() + string.slice(1).toLowerCase()
getRandomSyllable = ->
vowels = 'aeiouy'
consonants = 'bcdfghjklmnpqrstvwxz'
consonantSounds = ['b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','z','th','ch']
@mef51
mef51 / circles.js
Last active August 29, 2015 14:05
Pulsing circles with d3 bro
var pi = Math.PI,
sin = Math.sin,
cos = Math.cos
var t = 0;
setInterval(function(){
var data = [sin(t)+1, cos(t)+1, sin(t)+1, cos(t)+1, sin(t)+1];
// bind circle elements to data
@mef51
mef51 / dancingCircles.js
Created August 22, 2014 16:53
dancing circles with d3 bro
var pi = Math.PI,
cos = Math.cos,
sin = Math.sin;
var thetaStep = 0.1;
var angle = pi;
var r = 10;
var length = 50;
var offx = offy = 125;
@mef51
mef51 / gist:e9eb78c246f30543c5db
Last active October 11, 2016 16:55
Links on Computer Graphics for Talk at uOttawa Nov. 6, 2014
acko.net
http://www.playfuljs.com/a-first-person-engine-in-265-lines/
http://www.scratchapixel.com/lessons/3d-basic-lessons/lesson-1-writing-a-simple-raytracer/
http://learningwebgl.com/blog/?page_id=1217
http://jsfiddle.net/vz5aZ/2/
http://jsfiddle.net/uzMPU/
http://threejs.org/docs/index.html#Manual/Introduction/Creating_a_scene
http://shdr.bkcore.com/
http://vimeo.com/88957041
http://www.youtube.com/watch?v=NdcnQISuF_Y
@mef51
mef51 / earthsun.js
Created October 11, 2016 16:57
dinky simulation of earth sun system, storing here
#!/usr/local/bin/node
var simulateEarthSunSystem = function(){
var G = 6.67e-11;
var earth = {
x: 150e9, // m
y: 0,
radius: 6371e3, // m
m: 5.9e24, // kg
@mef51
mef51 / frb180814.py
Last active September 14, 2020 18:27
#!/usr/bin/python3
import numpy as np
import matplotlib.pyplot as plt
import os
import skimage.measure
def dedisperse(intensity, DM, nu_high, chan_width, timestep):
dedispersed = np.copy(intensity)