Skip to content

Instantly share code, notes, and snippets.

Avatar

Tamim Bin Ibrahim tamimibrahim

View GitHub Profile
View convert-mp3-frm-webm.txt
FILE="the-file-location.webm"
ffmpeg -i "${FILE}" -vn -ab 128k -ar 44100 -y "${FILE%.webm}.mp3"
@Skalman
Skalman / index.php
Created Apr 20, 2015
Dynamic RSS feeds from Youtube links
View index.php
<?php
if (!isset($_GET['url'])) {
?>
<!DOCTYPE html>
<meta charset="utf-8">
<title>Youtube RSS creator</title>
<form>
<p>Create an RSS feed for the videos on the following page:
<p><input name="url" placeholder="E.g. https://www.youtube.com/user/scishow/videos" style="width: 30em">
@rupl
rupl / picturefill-test.js
Last active Jul 4, 2017
A CasperJS script to test the canonical Picturefill demo. This sample accompanies a blog post series about CasperJS found at http://fourword.fourkitchens.com/article/using-casperjs-test-picturefill
View picturefill-test.js
/**
* @file
* Testing to see if Picturefill selects the right source at multiple
* viewport sizes.
*/
// Define the suite of tests and give it the following properties:
// - Title, which shows up before any of the pass/fails.
// - Number of tests, must be changed as you add tests.
// - suite(), which contains all of your tests.
View album_description.rb
require 'watir-webdriver'
puts "== Album Description Updater =="
description = File.read(ARGV[0])
parts = description.scan(/https:\/\/www\.facebook\.com\/.*?\/media_set\S+/)
puts "There are #{parts.length} albums whose descriptions are to be updated!"
browser = Watir::Browser.new :firefox, :profile => 'watir'
@scottjehl
scottjehl / noncritcss.md
Last active Jan 27, 2022
Comparing two ways to load non-critical CSS
View noncritcss.md

I wanted to figure out the fastest way to load non-critical CSS so that the impact on initial page drawing is minimal.

TL;DR: Here's the solution I ended up with: https://github.com/filamentgroup/loadCSS/


For async JavaScript file requests, we have the async attribute to make this easy, but CSS file requests have no similar standard mechanism (at least, none that will still apply the CSS after loading - here are some async CSS loading conditions that do apply when CSS is inapplicable to media: https://gist.github.com/igrigorik/2935269#file-notes-md ).

Seems there are a couple ways to load and apply a CSS file in a non-blocking manner:

@akiyoshi83
akiyoshi83 / scrape.js
Created May 15, 2014
CasperJS scraping sample
View scrape.js
var system = require('system');
var fs = require('fs');
var args = system.args;
// args is phantomjs api.
// args [3] and later arguments of casperjs
var _args = args.slice(3);
if(_args.length < 2) {
console.log("USAGE: casperjs scrape.js URL");
phantom.exit();
View fake-referer.casper.coffee
# Define Variables + Casper Initialization
fakeReferer = 'https://google.com/'
targetUrl = 'https://facebook.com/'
casper = require('casper').create()
# Fake the referer
casper.start fakeReferer, ->
View Makefile
run:
casperjs index.js && convert *.jpg video.mpeg && gify video.mpeg out.gif && rm *.jpg video.mpeg
View index.js
var fs = require('fs');
var parse = require('url').parse;
var uid = require('uid2');
var express = require('express');
var phantomjs = require('phantom');
var app = express();
app.use(express.logger('dev'));
View screenshots.js
/*
* Takes provided URL passed as argument and make screenshots of this page with several viewport sizes.
* These viewport sizes are arbitrary, taken from iPhone & iPad specs, modify the array as needed
*
* Usage:
* $ casperjs screenshots.js http://example.com
*/
var casper = require("casper").create();