Skip to content

Instantly share code, notes, and snippets.

View jalasem's full-sized avatar
🏠
Working from home

AbdulSamii Ajala jalasem

🏠
Working from home
View GitHub Profile
@jalasem
jalasem / designer.html
Last active August 29, 2015 14:10
designer
<link href="../core-icon-button/core-icon-button.html" rel="import">
<link href="../core-toolbar/core-toolbar.html" rel="import">
<link href="../core-header-panel/core-header-panel.html" rel="import">
<link href="../core-icons/core-icons.html" rel="import">
<link href="../core-icon/core-icon.html" rel="import">
<link href="../core-input/core-input.html" rel="import">
<polymer-element name="my-element">
<template>
@jalasem
jalasem / localStorage_bomb.html
Created May 16, 2016 04:59 — forked from kampar/localStorage_bomb.html
localStorage bomb to test your browser on how many characters your browser able to save
<html>
<head>
<title>M. Jazman, Fuse</title>
<meta charset="utf-8">
<script>
localStorage.setItem("fuse", "-");
while(true) {
var fuse = localStorage.getItem("fuse");
try {
@jalasem
jalasem / lambda-not-anon.md
Created August 4, 2016 19:12
The distinction between anonymous functions and lambdas in JavaScript.

TL;DR - Lambda means "function used as data".

Anonymous function means "function without a name".

This is one of the relatively few cases where the Wikipedia definition of a word, while not entirely wrong, is misleading. Lambdas and anonymous functions are distinct ideas.

These ideas are commonly confused because in many programming languages (and lambda calculus) all lambdas are anonymous or vise verse.

In JavaScript, not all lambdas are anonymous, and not all anonymous functions are lambdas, so the distinction has some practical meaning.

@jalasem
jalasem / nigeria_state_polygons.json
Created October 9, 2017 22:12 — forked from logbon72/nigeria_state_polygons.json
Coordinate Boundaries for Nigerian States
{
"ABIA": [
[5.3918045732398, 7.3196411132812],
[5.4246168391946, 7.3388671875],
[5.4437565043427, 7.3663330078125],
[5.5285105256928, 7.4020385742188],
[5.6282859838703, 7.4006652832031],
[5.6856833027592, 7.3814392089844],
[5.6952489676056, 7.4020385742188],
[5.8428131655266, 7.3855590820312],
@jalasem
jalasem / app.js
Last active November 26, 2017 11:18
NodeAuthTuts
// define dependencies
const express = require('express');
const bodyParser = require('body-parser');
const mongoose = require('mongoose');
const shortid = require('shortid');
const session = require('express-session'); //we're using 'express-session' as 'session' here
const bcrypt = require("bcrypt"); //
const app = express();
const PORT = 3000; // you can change this if this port number is not available
@jalasem
jalasem / intro.md
Created March 4, 2018 22:41 — forked from derhuerst/intro.md
Installing the Z Shell (zsh) on Linux, Mac OS X and Windows

Installing zsh – the easy way

The Z shell (zsh) is a Unix shell [...]. Zsh can be thought of as an extended Bourne shell with a large number of improvements, including some features of bash, ksh, and tcsh.

Z shell – Wikipedia

Read more about ZSH at An Introduction to the Z Shell.

Choose one of the following options.

#!/bin/bash
hostname=$(hostname -s)
cd ~/Library/Application\ Support/com.bohemiancoding.sketch3/
rm .license && touch .license && echo '{"meta":{"generated_at":"'$(date)'","sign":"==","device_name":"'$hostname "("$(id -un)')"},"payload":{"status":"ok","application":"sketch3","type":"license","udid":"c2d8c1dd037f919d57124de1037eeb22efad6bd1","expiration":"9999999999"}}' >> .license
echo '127.0.0.1 backend.bohemiancoding.com' | sudo tee -a /etc/hosts
@jalasem
jalasem / js-speech.js
Last active October 16, 2018 17:19
CodePad
function speak (message) {
var msg = new SpeechSynthesisUtterance(message)
var voices = window.speechSynthesis.getVoices()
msg.voice = voices[0]
window.speechSynthesis.speak(msg)
}
speak('Hello, world')
const cluster = require('cluster')
const express = require('express')
const fs = require('fs')
const CPUs = require('os')
.cpus()
.length
if (cluster.isMaster) {
console.log(`Master cluster setting up ${CPUs} workers...`)
@jalasem
jalasem / server.js
Created November 7, 2017 01:38
A simple express server for USSD application
const app = require('express')()
const bodyParser = require('body-parser')
const logger = require('morgan')
const port = process.env.PORT || 3030
app.use(logger('dev'))
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({extended: true}))