Skip to content

Instantly share code, notes, and snippets.

View lambdaX's full-sized avatar

Islam Ali lambdaX

View GitHub Profile
@lambdaX
lambdaX / package.json
Created October 7, 2020 20:59 — forked from mallendeo/package.json
Record gsap animations frame by frame with puppeteer
{
"name": "gsap-to-video",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"fs-extra": "^7.0.0",
"puppeteer": "^1.7.0"
}
}
@lambdaX
lambdaX / alexa.js
Created April 19, 2018 03:43 — forked from chilts/alexa.js
Getting the Alexa top 1 million sites directly from the server, unzipping it, parsing the csv and getting each line as an array.
var request = require('request');
var unzip = require('unzip');
var csv2 = require('csv2');
request.get('http://s3.amazonaws.com/alexa-static/top-1m.csv.zip')
.pipe(unzip.Parse())
.on('entry', function (entry) {
entry.pipe(csv2()).on('data', console.log);
})
;
@lambdaX
lambdaX / selenium_chromedriver_performance.py
Last active October 26, 2016 15:30
selenium_chromedriver_performance.py by @klepikov
# This does not include WebPageTest submission, only an illustration
# how to use the Logging API from the WebDriver Python bindings.
from selenium import webdriver
from selenium.webdriver.common import keys
driver = webdriver.Chrome(
executable_path="chromedriver2_server",
desired_capabilities={'loggingPrefs': {'performance': 'INFO'}})
@lambdaX
lambdaX / git-unsorted-log.go
Created February 28, 2016 18:58 — forked from timhughes/git-unsorted-log.go
An example of howto user git2go https://github.com/libgit2/git2go which is a libgit2 bindings package for golang
/*
requires libgit2
*/
package main
import (
@lambdaX
lambdaX / patchable.py
Last active September 21, 2015 12:41 — forked from jacobian/patchable.py
Adds PATCH support to tastypie
from django.core import urlresolvers
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
from django.db import transaction
from tastypie.exceptions import BadRequest
from tastypie.http import HttpAccepted, HttpGone, HttpMultipleChoices
from tastypie.utils import dict_strip_unicode_keys
class Patchable(object):
"""
Mixin adding PATCH support to a ModelResource.
@lambdaX
lambdaX / tastypie_resource.py
Last active September 21, 2015 12:39
Example of a custom django-tastypie Resource
from tastypie import fields
from tastypie.authentication import Authentication
from tastypie.authorization import Authorization
from tastypie.bundle import Bundle
from tastypie.exceptions import NotFound
from tastypie.resources import Resource
# a dummy class representing a row of data
class Row(object):
@lambdaX
lambdaX / httpQmlJson.qml
Last active September 21, 2015 12:33 — forked from 40/httpQmlJson.qml
Simple HTTP JSON Request in QML
import bb.cascades 1.0
Page {
content: Container {
Label {
id: emailLabel
text: qsTr("Email")
}
Label {
id: urlLabel
@lambdaX
lambdaX / index.js
Created September 24, 2014 16:17
requirebin sketch
// example using the raf module from npm. try changing some values!
var requestAnimationFrame = require("raf")
var canvas = document.createElement("canvas")
canvas.width = 500
canvas.height = 500
document.body.appendChild(canvas)
var context = canvas.getContext("2d")
@lambdaX
lambdaX / array-chunk.js
Created September 4, 2014 07:24
My way to chunk an Array
Array.prototype.chunk = function (n) {
return this.reduce(function (g,v,i) {
var chunk = (i-i%n) / n;
if (!(i%n)) g[chunk] = [];
g[chunk].push(v);
return g;
@lambdaX
lambdaX / isValidURL.js
Last active August 29, 2015 14:05
Test-embed-gists
function isValidURL(s) {
var testRegex = /^https?:\/\/(?:[a-z\-]+\.)+[a-z]{2,6}(?:\/[^\/#?]+)+\.(?:jpe?g|gif|png)$/;
return testRegex.test(s);
}