Skip to content

Instantly share code, notes, and snippets.

Verifying that +hakimelek is my blockchain ID. https://onename.com/hakimelek
<script src="script.js"></script>
<div id="now" data-username="hakimelek"></div>
@hakimelek
hakimelek / zipcodesDistances.R
Last active January 30, 2017 08:03
Get distance from a list of zipcodes
returnDistanceFromVector = function(origin, listOfZipcodes){
library(geosphere)
library(ggmap)
originCoord = geocode(as.character(origin))
result = data.frame(Zipcode=numeric(), distance= numeric())
for(i in 1:length(listOfZipcodes))
{
@hakimelek
hakimelek / us_institutions.json
Created September 28, 2016 09:36
A List of American Colleges and Universities in JSON format
[
{
"institution": "Alabama A & M University"
},
{
"institution": "University of Alabama at Birmingham"
},
{
"institution": "Amridge University"
},
// You have an array of objects in JavaScript. Each one contains a name (a string) and ranking (a number).
// Write two functions, one to return the objects ordered by ranking and another to return the average ranking.
var order = function (arr) {
return arr.sort(function (a, b) {
if (a.ranking > b.ranking) {
return 1;
}
if (a.ranking < b.ranking) {
return -1;
@hakimelek
hakimelek / CoolRésumé.md
Last active December 30, 2016 18:38
Malek Hakim cool résumé

MALEK HAKIM

Software Engineer Brooklyn, New York

Software developer with over six years of web development experience. Passionate about full stack javascript apps and distributed web technologies.

WORK EXPERIENCE

VARIOUS PROJECTS 🇺🇸 🇹🇳

Full Stack Developer

Jan, 2010 – Current

var customary = function (str) {
var freq = {};
var stringArray = str.split('');
for (let i=0; i<stringArray.length; i++) {
let char = stringArray[i];
if (freq.hasOwnProperty(char)) freq[char]++;
else {
freq[char] = 0;
export default class SimplePromise {
constructor () {
this.status = 'pending'; // 3 states pending, resolved, rejected
this.result = null; // initially set to null
this.callbacks = [];
}
then(onResolved, onRejected) {
if (this.status === 'resolved')
return this.resolve(onResolved, onRejected);
@hakimelek
hakimelek / cache-control.js
Created June 8, 2017 20:09
Set cache control for assets except html
if (process.env.NODE_ENV === 'production') {
app.use('/drive/search/public', express.static(__dirname + '/../public'), {
maxAge: '1d',
setHeaders: setCustomCacheControl
});
} else {
app.use('/drive/search/public', express.static(__dirname + '/../client/src'));
}
@hakimelek
hakimelek / router.jsx
Created July 19, 2017 03:33
SSR for Styled components in Vulcanjs change this file -> packages/vulcan-routing/lib/server/router.jsx
import React from 'react';
import { match, RouterContext, createMemoryHistory } from 'react-router';
import { renderToString } from 'react-dom/server'
import { ServerStyleSheet } from 'styled-components'
import moment from 'moment';
import { RoutePolicy } from 'meteor/routepolicy';
import { withRenderContextEnvironment, InjectData } from 'meteor/vulcan:lib';