Skip to content

Instantly share code, notes, and snippets.

View aug2uag's full-sized avatar

Reza Fatahi aug2uag

  • Los Angeles, CA
View GitHub Profile
@aug2uag
aug2uag / action_form.js
Created June 15, 2017 03:05
action form
var iiii = 0;
function increment() {
iiii += 1;
}
function createActionsInit() {
function removeElement(parentDiv, childDiv){
if (childDiv == parentDiv) return
if (document.getElementById(childDiv)) {
var child = document.getElementById(childDiv);
#!/bin/bash
PHANTOM_JS="phantomjs-1.9.8-linux-x86_64"
if [[ $EUID -ne 0 ]]; then
echo "You must be a root user" 2>&1
exit 1
else
apt-get update
apt-get install -y build-essential chrpath libssl-dev libxft-dev
apt-get install -y libfreetype6 libfreetype6-dev
apt-get install -y libfontconfig1 libfontconfig1-dev
@aug2uag
aug2uag / timestamp_sort.js
Created August 17, 2016 17:14
timestamp sort JS
var o = [
{created:1356036198452 , val:'1356036198452 '},
{created:1356039026690, val:'1356039026690'},
{created:1356039067568, val:'1356039067568'},
{created:1356035166411, val:'1356035166411'}
]
function newestToOldest(a,b) {
if (a.created < b.created)
return 1;
@aug2uag
aug2uag / app.js
Last active June 10, 2020 00:03
simplest static server
// simple static server
let express = require('express'),
app = express(),
// favicon = require('serve-favicon'),
bodyParser = require('body-parser');
// content directory(ies)
app.use(express.static('public'));
// app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')))
@aug2uag
aug2uag / no_multipart.js
Last active February 23, 2016 00:43
JS image upload with progress bar (not multipart/form)
var file = $('#filesToUpload').get(0).files[0];
if (!file) {
alert('no file');
return;
};
var o = {};
o.category = cat;
o.name = 'some file';
@aug2uag
aug2uag / uber.yaml
Created February 21, 2016 20:49 — forked from earth2marsh/uber.yaml
A Swagger YAML specification for Uber's new API
swagger: 2
info:
title: The new Uber API
description: Move your app forward with the Uber API
version: "1.0.0"
host: api.uber.com
schemes:
- https
basePath: /v1
produces:
@aug2uag
aug2uag / gifsicle_remove2.sh
Created January 28, 2016 17:25
remove every second frame of GIF with gifsicle
#!/bin/bash
# This script will take an animated GIF and delete every other frame
# Accepts two parameters: input file and output file
# Usage: ./<scriptfilename> input.gif output.gif
# Make a copy of the file
cp $1 $2
echo "copy completed"
# Get the number of frames
numframes=`gifsicle $1 -I | grep -P "\d+ images" --only-matching | grep -P "\d+" --only-matching`
@aug2uag
aug2uag / gifsicle_remove2.sh
Created January 28, 2016 17:25
remove every second frame of GIF with gifsicle
#!/bin/bash
# This script will take an animated GIF and delete every other frame
# Accepts two parameters: input file and output file
# Usage: ./<scriptfilename> input.gif output.gif
# Make a copy of the file
cp $1 $2
echo "copy completed"
# Get the number of frames
numframes=`gifsicle $1 -I | grep -P "\d+ images" --only-matching | grep -P "\d+" --only-matching`
@aug2uag
aug2uag / index
Last active December 6, 2015 12:10 — forked from mrsonord/index
Html head snippet with everything you would generally use.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<meta name='DC.title' content=''>
<meta name='subtitle' content='This is my subtitle'>
<meta name='url' content=''>
<meta name='identifier-URL' content=''>
<meta name='reply-to' content='email@mail.com'>
@aug2uag
aug2uag / monthDiff.js
Created December 5, 2015 20:44
delta months between two JS Date objects
function monthDiff(d1, d2) {
var months;
months = (d2.getFullYear() - d1.getFullYear()) * 12;
months -= d1.getMonth() + 1;
months += d2.getMonth();
return months <= 0 ? 0 : months;
}