Skip to content

Instantly share code, notes, and snippets.

@hakimelek
hakimelek / priceline.com.har
Created Feb 26, 2019
HAR file for Priceline.com
View priceline.com.har
This file has been truncated, but you can view the full file.
{
"log": {
"version": "1.2",
"creator": {
"name": "WebInspector",
"version": "537.36"
},
"pages": [
{
@hakimelek
hakimelek / script.js
Created Jun 29, 2018
Detect Latest Image loaded on the page
View script.js
const imagePath = '/path/to/image'
let latestImageTiming = 0
const p = window.performance.getEntriesByType('resource')
p.filter(e => { e.name.indexOf(imagePath) >= 0 && (latestImageTiming = Math.max(latestImageTiming, e.responseEnd))})
console.log(latestImageTiming)
View CracklePop.js
Array(100)
.fill(0)
.map((a, i) => i+1)
.forEach(num => {
if (num % 3 === 0 && num % 5 === 0) return console.log('CracklePop')
else if (num % 3 === 0) return console.log('Crackle')
else if (num % 5 === 0) return console.log('Pop')
return console.log(num)
})
View Blockstack
Verifying my Blockstack ID is secured with the address 1Mz5PM3Ag4H3V6kEo63zHLKpTx7piuVNk4 https://explorer.blockstack.org/address/1Mz5PM3Ag4H3V6kEo63zHLKpTx7piuVNk4
@hakimelek
hakimelek / webperf.js
Created Aug 22, 2017
Web performance object
View webperf.js
/**
* Web performance object example:
*/
import 'performance-polyfill';
class WebPerfMetrics {
constructor() {
this.performance = window.performance || window.mozPerformance || window.msPerformance || window.webkitPerformance || {};
this.timing = (this.performance && this.performance.timing) ? this.performance.timing : null;
@hakimelek
hakimelek / router.jsx
Created Jul 19, 2017
SSR for Styled components in Vulcanjs change this file -> packages/vulcan-routing/lib/server/router.jsx
View 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';
@hakimelek
hakimelek / cache-control.js
Created Jun 8, 2017
Set cache control for assets except html
View cache-control.js
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'));
}
View CustomPromise.js
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);
View customary.js
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;
@hakimelek
hakimelek / CoolRésumé.md
Last active Dec 30, 2016
Malek Hakim cool résumé
View CoolRésumé.md

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