Skip to content

Instantly share code, notes, and snippets.

View thaerlabs's full-sized avatar

Thaer Abbas thaerlabs

View GitHub Profile
@thaerlabs
thaerlabs / gist:2013418
Created March 10, 2012 21:47
HTML: Page Template
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Your Website</title>
</head>
<body>
section {
padding-top: 60px;
}
.subnav {
margin-bottom: 60px;
width: 100%;
height: 36px;
background-color: #eeeeee; /* Old browsers */
background-repeat: repeat-x; /* Repeat the gradient */

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@thaerlabs
thaerlabs / v2p.html
Last active August 29, 2015 14:21 — forked from elclanrs/v2p.html
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="v2p.js"></script>
<style type="text/css" media="all">
body { margin: 0; }
div {
background: #fa7098;
}
@thaerlabs
thaerlabs / .babelrc
Last active November 16, 2016 17:36
React hello world is not hard
{
"presets": ["es2015", "react"]
}
[{"created_at":"Thu Jun 02 13:57:33 +0000 2016","username":"Laura C","profile_image_url":"http://pbs.twimg.com/profile_images/660720426687967232/fWfBSQBO_normal.jpg","text":"Il David di Michelangelo 💕 #Florence #Italy @ Galleria Dell' Academia, Firenze, Italia https://t.co/HD8Z0poZAY","images":[],"geo":{"lat":43.77629,"lng":11.25864836},"content":"<div>\n <p class=\"profile_image\"><img src=\"http://pbs.twimg.com/profile_images/660720426687967232/fWfBSQBO_normal.jpg\" alt=\"Laura C\"></p>\n <p class=\"username\">@Laura C</p>\n <p class=\"content\">Il David di Michelangelo 💕 #Florence #Italy @ Galleria Dell&#39; Academia, Firenze, Italia https://t.co/HD8Z0poZAY</p>\n \n <p><small><strong>Posted at:</strong> Thu Jun 02 13:57:33 +0000 2016</small></p>\n <p><small><strong>lat:</strong> 43.77629 </small> <small><strong>lng:</strong> 11.25864836</small></p>\n</div>\n"},{"created_at":"Thu Jun 02 13:57:19 +0000 2016","username":"Panna & Pomodoro","profile_image_url":"http://pbs.twimg.com/profile_ima
const input = [[1,2,[3]],4];
function arrFlatten() {
let flat = [];
for (let i = 0; i < arguments.length; i++) {
if (arguments[i] instanceof Array) {
flat.push.apply(flat, arrFlatten.apply(this, arguments[i]));
} else {
flat.push(arguments[i]);
}
@thaerlabs
thaerlabs / express-sample.js
Last active November 7, 2017 19:42
express sample
const express = require('express');
const bodyParser = require('body-parser');
const app = express();
const PORT = 3000;
app.use(bodyParser.json());
app.get('/', (req, res) => {
const name = req.query;
res.send('Login form');
@thaerlabs
thaerlabs / AbstractModel.js
Created December 8, 2017 01:36 — forked from dsumer/AbstractModel.js
linkState for mobx-state-tree
import {types, getType} from 'mobx-state-tree';
function getValueFromPath(value, valuePath) {
if (valuePath) {
const path = valuePath.split('.');
let endValue = value;
for (const pathItem of path) {
endValue = endValue[pathItem];
}
return endValue;