Skip to content

Instantly share code, notes, and snippets.

View persianturtle's full-sized avatar

Raphael Rafatpanah persianturtle

View GitHub Profile
@persianturtle
persianturtle / PhantomJS Screen Capture Script
Last active May 17, 2016 15:30
This script screenshots an array of URLs against an array of viewports after dynamically scrolling through the entire page using jQuery.
'use strict';
var page = require('webpage').create();
var loadInProgress = false;
var pageIndex = 0;
var viewportIndex = 0;
var urls = [
'https://google.com',
'https://kokorugs.com'
@persianturtle
persianturtle / ffmpeg
Last active January 10, 2017 16:31
List of useful ffmpeg commands
// Convert 4444/422 to WEBM
ffmpeg -i input.mov -c:v libvpx -qmin 0 -qmax 25 -crf 4 -b:v 1M -vf scale=1280:-2 -an -threads 0 output.webm
// Enable audio
ffmpeg -i input.mov -c:v libvpx -qmin 0 -qmax 25 -crf 4 -b:v 1M -threads 0 output.webm
// Convert 4444/422 to WEBM - Smaller bitrate
ffmpeg -i input.mov -c:v libvpx -qmin 0 -qmax 25 -crf 4 -b:v 256k -vf scale=1280:-2 -an -threads 0 output.webm
import React, { PropTypes, Component } from 'react';
import ApolloClient, { createNetworkInterface } from 'apollo-client';
import { ApolloProvider } from 'react-apollo';
import { Router, Route, IndexRoute, browserHistory } from 'react-router'
import './App.css';
import BookSearch from './BookSearch';
import BookDetails from './BookDetails';
import GoogleMap from 'google-map-react';
[%bs.raw {|require('./index.css')|}];
[@bs.module "./registerServiceWorker"] external register_service_worker : unit => unit = "default";
ReactDOMRe.renderToElementWithId(<App />, "root");
register_service_worker();
[%bs.raw {|require('./app.css')|}];
let component = ReasonReact.statelessComponent("App");
let make = _children => {
...component,
render: _self => <div className="App" />
};
[%bs.raw {|require('./app.css')|}];
type route =
| Home
| Page1
| Page2
| Page3;
type routeWithTitle = (route, string);
.App {
min-height: 100vh;
&:after {
content: '';
transition: opacity 450ms cubic-bezier(0.23, 1, 0.32, 1),
transform 0ms cubic-bezier(0.23, 1, 0.32, 1) 450ms;
position: fixed; top: 0; right: 0; bottom: 0; left: 0;
background-color: rgba(0, 0, 0, 0.33);
transform: translateX(-100%);
body {
margin: 0;
font-family: Helvetica, Arial, sans-serif;
}
h1, h2, h3 {
font-weight: normal;
}
img {
@persianturtle
persianturtle / app.re
Created February 13, 2018 02:24
Just the render field
render: self => {
let (route, title) = self.state.routeWithTitle;
<div
className=("App" ++ (self.state.nav.isOpen ? " overlay" : ""))
onClick=(_event => self.send(ToggleMenu(false)))>
<header>
<a
onClick=(
event => {
ReactEventRe.Mouse.stopPropagation(event);
.App:after {
content: '';
transition: opacity 450ms cubic-bezier(0.23, 1, 0.32, 1),
transform 0ms cubic-bezier(0.23, 1, 0.32, 1) 450ms;
position: fixed; top: 0; right: 0; bottom: 0; left: 0;
background-color: rgba(0, 0, 0, 0.33);
transform: translateX(-100%);
opacity: 0;
z-index: 1;
}