Skip to content

Instantly share code, notes, and snippets.

View milnomada's full-sized avatar

milnomada milnomada

View GitHub Profile
@ErisDS
ErisDS / examples.md
Last active May 2, 2024 08:23
Ghost Filter Query examples

Filter Queries - Example Use Cases

Here are a few example use cases, these use cases combine filter with other parameters to make useful API queries. The syntax for any of this may change between now, implementation, and release - they're meant as illustrative examples :)

Fetch 3 posts with tags which match 'photo' or 'video' and aren't the post with id 5.

api.posts.browse({filter: "tags:[photo, video] + id:-5", limit="3"});

GET /api/posts?filter=tags%3A%5Bphoto%2Cvideo%5D%2Bid%3A-5&limit=3

@luisnomad
luisnomad / BookMarklet Get YouTube poster image.html
Last active June 11, 2022 12:46
Get the current YouTube video's poster image (highest resolution available) with this simple Bookmarklet
<a href ="javascript:(function()%7Bfunction%20getParameterByName(name)%20%7Bname%20%3D%20name.replace(%2F%5B%5C%5B%5D%2F%2C%20%22%5C%5C%5B%22).replace(%2F%5B%5C%5D%5D%2F%2C%20%22%5C%5C%5D%22)%3Bvar%20regex%20%3D%20new%20RegExp(%22%5B%5C%5C%3F%26%5D%22%20%2B%20name%20%2B%20%22%3D(%5B%5E%26%23%5D*)%22)%2Cresults%20%3D%20regex.exec(location.search)%3Breturn%20results%20%3D%3D%20null%20%3F%20%22%22%20%3A%20decodeURIComponent(results%5B1%5D.replace(%2F%5C%2B%2Fg%2C%20%22%20%22))%3B%7Dvar%20id%20%3D%20getParameterByName%20(%22v%22)%3Bif%20(typeof%20id%20!%3D%3D%20null%20%26%26%20id%20!%3D%3D%22%22)%20%7Bvar%20url%20%3D%20%22http%3A%2F%2Fimg.youtube.com%2Fvi%2F%22%20%2B%20id%20%2B%20%22%2Fmaxresdefault.jpg%22%3Bwindow.open(url%2C'_blank')%3B%7D%20else%20%7Balert%20(%22Activate%20the%20tab%20in%20your%20browser%20where%20the%20YouTube%20video%20is%20loaded%20and%20try%20again!%22)%3B%7D%7D)()">Grab Poster Image</a>
@graydon
graydon / country-bounding-boxes.py
Created April 23, 2014 00:03
country bounding boxes
# extracted from http//www.naturalearthdata.com/download/110m/cultural/ne_110m_admin_0_countries.zip
# under public domain terms
country_bounding_boxes = {
'AF': ('Afghanistan', (60.5284298033, 29.318572496, 75.1580277851, 38.4862816432)),
'AO': ('Angola', (11.6400960629, -17.9306364885, 24.0799052263, -4.43802336998)),
'AL': ('Albania', (19.3044861183, 39.624997667, 21.0200403175, 42.6882473822)),
'AE': ('United Arab Emirates', (51.5795186705, 22.4969475367, 56.3968473651, 26.055464179)),
'AR': ('Argentina', (-73.4154357571, -55.25, -53.628348965, -21.8323104794)),
'AM': ('Armenia', (43.5827458026, 38.7412014837, 46.5057198423, 41.2481285671)),
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active February 12, 2024 17:18
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

OBSOLETE

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

@dasher
dasher / litecoin.conf
Created December 22, 2012 18:13
example litecoin.conf
# litecoin.conf configuration file. Lines beginning with # are comments.
# Network-related settings:
# Run on the test network instead of the real litecoin network.
#testnet=0
# Connect via a socks4 proxy
#proxy=127.0.0.1:9050
@antics
antics / gist:4079584
Created November 15, 2012 16:34
Login to Wordpress with curl
curl -D cookie1.txt blog.xrmplatform.org/wp-login.php
# step 1
# get default cookie of blog and write cookie to cookie1.txt
# step 2
# simulate browser Firefox( of course , you can use any browser agent<!--more--> what you want!) "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"
# input your username and also password
# write new cookie to cookie2.txt
curl -A "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6" -D cookie2.txt -b cookie1.txt -F log=username -F pwd=password -F testcookie=1 -F wp-submit="Log In" -F redirect_to=blog.xrmplatform.org/wp-admin -F submit=login -F rememberme=forever blog.xrmplatform.org/wp-login.php
# currently cookie2.txt stored all cookie info
@mariussoutier
mariussoutier / Mail.scala
Created August 23, 2012 12:13
Sending mails fluently in Scala
package object mail {
implicit def stringToSeq(single: String): Seq[String] = Seq(single)
implicit def liftToOption[T](t: T): Option[T] = Some(t)
sealed abstract class MailType
case object Plain extends MailType
case object Rich extends MailType
case object MultiPart extends MailType