Skip to content

Instantly share code, notes, and snippets.

View dandyraka's full-sized avatar
🚶‍♂️
Lontang lantung

Dandy Raka dandyraka

🚶‍♂️
Lontang lantung
View GitHub Profile
@nicklasos
nicklasos / download.php
Last active January 31, 2024 09:13
Curl PHP multiple files downloading
<?php
function multiple_download(array $urls, $save_path = '/tmp')
{
$multi_handle = curl_multi_init();
$file_pointers = [];
$curl_handles = [];
// Add curl multi handles, one per file we don't already have
foreach ($urls as $key => $url) {
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@mistic100
mistic100 / imageroundedrectangle.php
Last active October 27, 2021 08:47
[PHP] Draw a rectangle with rounded corners
<?php
/**
* Draw a rectangle with rounded corners.
* @param ressource &$img An image resource
* @param int $x1 Upper left x coordinate
* @param int $y1 Upper left y coordinate
* @param int $x2 Bottom right x coordinate
* @param int $y2 Bottom right y coordinate
* @param int $r Corners radius
* @param int $color A color identifier created with imagecolorallocate()
@sokcuri
sokcuri / key.md
Last active July 9, 2022 10:39
Twitter (un)official Consumer Key

Twitter Official Consumer Key

Twitter for Android

type:            PIN
Consumer key:    3nVuSoBZnx6U4vzUxf5w
Consumer secret: Bcs59EFbbsdF6Sl9Ng71smgStWEGwXXKSjYvPVt7qys

Twitter for iPhone

type:            PIN

Consumer key: IQKbtAYlXLripLGPWd0HUA

@nealrs
nealrs / page.html
Created October 28, 2016 18:23
twitter player card sample
<!DOCTYPE html>
<html>
<head>
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type' />
<meta name="twitter:card" content="player" />
<meta name="twitter:site" content="@wakeyio" />
<meta name="twitter:title" content="Hemopure ~ Wakey Wakey #26" />
<meta name="twitter:description" content="Hemopure is an artificial blood (HBOC) that’s saving lives in South Africa. It’s shelf stable and 100% compatible with all blood types." />
<meta name="twitter:image" content="https://wakey.io/public/img/thumbs/26.png" />
<meta name="twitter:player" content="https://wakey.io/embed/26" />
@jesperorb
jesperorb / cors.md
Last active February 21, 2024 14:17
Handle CORS Client-side

Handle CORS Client-side

Cross-origin resource sharing (CORS) is a mechanism that allows restricted resources (e.g. fonts) on a web page to be requested from another domain outside the domain from which the first resource was served. This is set on the server-side and there is nothing you can do from the client-side to change that setting, that is up to the server/API. There are some ways to get around it tho.

Sources : MDN - HTTP Access Control | Wiki - CORS

CORS is set server-side by supplying each request with additional headers which allow requests to be requested outside of the own domain, for example to your localhost. This is primarily set by the header:

Access-Control-Allow-Origin
@deanrad
deanrad / cors.js
Last active April 9, 2021 09:26
Using CORS-Anywhere via AJAX
/*
If you are attempting to call an AJAX API, via GET which responds:
No 'Access-Control-Allow-Origin' header is present on the requested resource.
You can modify the way you query it to go through a server which will add the header.
Basically, you add the URL you want (with query string parameters) at the end of
'https://cors-anywhere.herokuapp.com/'
, and ensure that your ajax call is done with some additional options as shown below
See CORS-Anywhere documentation here for more:
@Fazzani
Fazzani / free_m3u8.m3u
Created July 28, 2018 09:13
Free m3u8 streams
http://sample.vodobox.net/skate_phantom_flex_4k/skate_phantom_flex_4k.m3u8
http://playertest.longtailvideo.com/adaptive/wowzaid3/playlist.m3u8
http://cdn-fms.rbs.com.br/vod/hls_sample1_manifest.m3u8
http://nasatv-lh.akamaihd.net/i/NASA_101@319270/index_1000_av-p.m3u8?sd=10&rebase=on
http://content.jwplatform.com/manifests/vM7nH0Kl.m3u8
$('.ProfileCard-content').each(function(){
var status = $(this).find('.FollowStatus').text();
var unfollowButton = $(this).find('.user-actions-follow-button');
if(!status){
unfollowButton.click();
}
});
@winuxue
winuxue / puppeteer-ubuntu-1804.md
Created May 22, 2019 01:15
Solution for common dependences issues using puppeteer in ubuntu 18.04 (Bionic)

puppeteer dependeces in ubuntu 18.04 (Bionic)

error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory

sudo apt-get install libnss3

error while loading shared libraries: libXss.so.1: cannot open shared object file: No such file or directory

sudo apt-get install libxss1