Skip to content

Instantly share code, notes, and snippets.

View tamimibrahim's full-sized avatar

Tamim Bin Ibrahim tamimibrahim

View GitHub Profile
@tamimibrahim17
tamimibrahim17 / convert-mp3-frm-webm.txt
Created February 24, 2018 17:27
Convert webm to mp3
FILE="the-file-location.webm"
ffmpeg -i "${FILE}" -vn -ab 128k -ar 44100 -y "${FILE%.webm}.mp3"
@Skalman
Skalman / index.php
Created April 20, 2015 23:48
Dynamic RSS feeds from Youtube links
<?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 July 4, 2017 10:44
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
/**
* @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.
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 August 12, 2023 16:57
Comparing two ways to load non-critical CSS

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 15:10
CasperJS scraping sample
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();
@LeCoupa
LeCoupa / fake-referer.casper.coffee
Last active October 21, 2020 10:43 — forked from papoms/fake-referrer.casper.js
How to fake the HTTP referer with CasperJS --> https://github.com/LeCoupa/awesome-cheatsheets
# Define Variables + Casper Initialization
fakeReferer = 'https://google.com/'
targetUrl = 'https://facebook.com/'
casper = require('casper').create()
# Fake the referer
casper.start fakeReferer, ->
run:
casperjs index.js && convert *.jpg video.mpeg && gify video.mpeg out.gif && rm *.jpg video.mpeg
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'));
/*
* 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();