Skip to content

Instantly share code, notes, and snippets.

@kvalood
kvalood / download-from-facecast.md
Created October 24, 2023 18:17 — forked from cornerot/download-from-facecast.md
How download video from facecast.net
@sumitpore
sumitpore / chrome-local-storage-api.js
Last active February 9, 2024 05:19
Chrome's Local StorageArea API in Synchronous way for use in Chrome extensions. Replace 'chrome.storage.local' by 'chrome.storage.sync' if you want to use Sync StorageArea
/**
* Retrieve object from Chrome's Local StorageArea
* @param {string} key
*/
const getObjectFromLocalStorage = async function(key) {
return new Promise((resolve, reject) => {
try {
chrome.storage.local.get(key, function(value) {
resolve(value[key]);
});
@gkhays
gkhays / Download File with Node.md
Created February 27, 2020 17:26
Download a file from a URL using Node.js

Download File from URL

Proof-of-concept to download a file from a URL and save it locally. For example, I may wish to retrieve a JAR file from Nexus.

Uses the http package, which does the basics with raw HTTP protocol support.

Possible update: use request, it is like the Python's requests library. There is a companion package called node-request-progress that tracks download progress. See request-progress on GitHub.

Note: The request package has been deprecated.

@chuv1
chuv1 / tgEntitiesToHTML.php
Last active November 18, 2023 09:37
Test function to convert telegram message entities into HTML markup.
public function getHTML($without_cmd = false){
if(empty($this->getEntities())){
return $this->getText($without_cmd);
}
$text = $this->getText();
$html = '';
$entities_count = \count($this->getEntities())-1;
@bigspawn
bigspawn / download-from-facecast.md
Last active April 28, 2024 12:18
How download video from facecast.net
@jarosluv
jarosluv / stations.json
Last active March 30, 2021 06:50
List of Moscow Metro Stations — 2016 / Список станций Московского метро — 2016
Станции метро переехали сюда https://github.com/jarosluv/russian_infrastructure.
@WinterSilence
WinterSilence / css-padding-hack.css
Last active September 4, 2020 11:57
CSS padding hack for create block with responsive square image
/* Example:
<div class="thumbnail">
<div class="square-box">
<a href="#"><img src="..." class="img-responsive" alt="..."></a>
</div>
</div>
*/
.square-box {
display: table;
@arcreative
arcreative / Retina.js
Last active November 26, 2016 05:34
Simple retina src replacement
//Note: this example assumes jQuery is available on your site.
Retina = function() {
return {
init: function(){
//Get pixel ratio and perform retina replacement
//Optionally, you may also check a cookie to see if the user has opted out of (or in to) retina support
var pixelRatio = !!window.devicePixelRatio ? window.devicePixelRatio : 1;
if (pixelRatio > 1) {
$("img").each(function(idx, el){
el = $(el);
@hitautodestruct
hitautodestruct / readme.md
Last active September 26, 2022 11:25 — forked from anonymous/gist:4344870
Generate a custom structure for Wordpress menus.

This gist is for showing an example of a custom wordpress menu.

If you want to get more from the menu item simply have a look at the $item object. i.e:

// Will return a large object with lots of props like title, url, description, id etc.
var_dump( $item );

This code works on Wordpress 4.1.1 as of 31st of March 2015

@edderrd
edderrd / parse_url.php
Created March 14, 2012 20:57
PHP: Parse url params
<?php
/**
* Parses a url to extract the query parameters from it as a assoc array
* @param string $url
* @param bool $decode (optional) apply url decode
* @return array
*/
function parseUrl($url, $decode = false)
{