Skip to content

Instantly share code, notes, and snippets.

@metamn
metamn / TypeScript.ts
Last active April 11, 2021 08:30
TypeScript
/**
* TypeScript, after all, helps only during development time.
* Runtime we've left with plain old JavaScript.
/
export const borderVariants = ["default", "smooth", "edoMenu"]; // This data is available later
export type TBorderVariants = typeof borderVariants[number]; // This data is lost
cs@cs-swift:~/work/pointhacks$ curl 'http://localhost:8000/wp-admin/admin-ajax.php' --data 'page=0&per_page=8&exclude=31325&action=ph_fetch_posts'
{"0":{"image":"<figure class=\"post-featured-image\"><a class=\"link\" href=\"http:\/\/localhost:8000\/platinum-one-benefits-guide\/\" title=\"Is it worth going the extra mile from Platinum to Platinum One status?\"><img src=\"http:\/\/i.pointhacks.com\/2019\/02\/28212904\/Qantas-Status_0.jpg\" class=\"attachment-large size-large wp-post-image\" alt=\"\" srcset=\"http:\/\/i.pointhacks.com\/2019\/02\/28212904\/Qantas-Status_0.jpg 653w, http:\/\/i.pointhacks.com\/2019\/02\/28212904\/Qantas-Status_0-300x175.jpg 300w, http:\/\/i.pointhacks.com\/2019\/02\/28212904\/Qantas-Status_0-286x166.jpg 286w, http:\/\/i.pointhacks.com\/2019\/02\/28212904\/Qantas-Status_0-301x175.jpg 301w, http:\/\/i.pointhacks.com\/2019\/02\/28212904\/Qantas-Status_0-330x192.jpg 330w, http:\/\/i.pointhacks.com\/2019\/02\/28212904\/Qantas-Status_0-381x222.jpg 381w, http:\/\/i.pointhacks.com\/2019\
@metamn
metamn / post-list-with-ad.php
Created February 5, 2019 14:27
A WordPress post list with ad
<?php
/**
* Displays a list of posts with an ad
*
* @package Pointhacks
*/
$post_list_title = get_query_var( 'post-list-title', 'Post list' );
$post_list_klass = get_query_var( 'post-list-klass', 'post-list--default' );
$post_list_posts = get_query_var( 'post-list-posts', null );
@metamn
metamn / post-list.php
Created February 5, 2019 14:25
A simple WordPress post list
?php
/**
* Displays a list of posts
*
* @package Pointhacks
*/
$post_list_title = get_query_var( 'post-list-title', 'Post list' );
$post_list_klass = get_query_var( 'post-list-klass', 'post-list--default' );
$post_list_posts = get_query_var( 'post-list-posts', null );
$post_list_post_format = get_query_var( 'post-list-post-format', '' );
@mixin latest-posts--regrid-for-ad($max-items-to-display-map, $margin-right) {
.dfp-holder {
width: 100%;
height: 90px;
background-color: black;
display: flex;
}
@include media('<tablet') {
$max-items-to-display: map-get($max-items-to-display-map, mobile);
@metamn
metamn / feed.liquid
Created February 2, 2011 10:14
Reading a (Shopify) feed with jQuery
<div id="blog">
{% assign feed_url = "http://shopledge.myshopify.com/blogs/news.atom" %}
<script type="text/javascript">
var api = "http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&callback=?&q={{ feed_url }}&num=5";
jQuery.getJSON(api, function(data){
// Check for error
if (data.responseStatus == 200) {
// Process the feeds
var feed = data.responseData.feed;
@metamn
metamn / gist:3793708
Created September 27, 2012 12:20
Smuff Visitors and Customers

Where Visitors Come From?

75% comes from Bucharest, Cluj, Constanta and Prahova.

Cluj, Constanta and Prahova have far better Conversion Rate and Average Order Value, however Bucharest is setting the site-wide standard.

@metamn
metamn / swiftype.md
Last active November 15, 2016 14:54
Swiftype

Swiftype

Requirements

In a nutshell we have:

1. A main Wordpress site where we do the search: www.site.com

This site will contain our subscription services, our offer, articles, blog posts written by us. Mostly tutorials how to use our platform.

@metamn
metamn / base_template.rb
Created May 19, 2009 14:35
Basic Rails Application Template
# this is a basic rails application template
# usage: rails <app_name> -m http://gist.github.com/114140.txt OR rails -d mysql ....
puts ""
puts "*******************************************************"
puts ""
puts "Basic Rails application generator with:"
puts " - MySQL support (creating development, test and production databases with configuration file database.yml)"
puts " - HAML/SASS/Compass support"
puts " - BDD support: Cucumber, RSpec, autospec"

Typography (Responsive)

Introduction

Responsive typography means two important things:

  1. The HTML <body> gets a default size set in percentage
  2. All other elements (larger and smaller text) are sized relative to 1.) using em instead of px.