Skip to content

Instantly share code, notes, and snippets.

Avatar

Raphael Rafatpanah persianturtle

View GitHub Profile
@persianturtle
persianturtle / PhantomJS Screen Capture Script
Last active May 17, 2016
This script screenshots an array of URLs against an array of viewports after dynamically scrolling through the entire page using jQuery.
View PhantomJS Screen Capture Script
'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 Jan 10, 2017
List of useful ffmpeg commands
View ffmpeg
// 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
View hackathon
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';
View index.re
[%bs.raw {|require('./index.css')|}];
[@bs.module "./registerServiceWorker"] external register_service_worker : unit => unit = "default";
ReactDOMRe.renderToElementWithId(<App />, "root");
register_service_worker();
View app.re
[%bs.raw {|require('./app.css')|}];
let component = ReasonReact.statelessComponent("App");
let make = _children => {
...component,
render: _self => <div className="App" />
};
View app.re
[%bs.raw {|require('./app.css')|}];
type route =
| Home
| Page1
| Page2
| Page3;
type routeWithTitle = (route, string);
View app.scss
.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%);
View index.css
body {
margin: 0;
font-family: Helvetica, Arial, sans-serif;
}
h1, h2, h3 {
font-weight: normal;
}
img {
@persianturtle
persianturtle / app.re
Created Feb 13, 2018
Just the render field
View app.re
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);
View app.css
.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;
}
You can’t perform that action at this time.