Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Plugin Name: Twitter Share Counts Tutorial
* Plugin URI: http://webdevstudios.com
* Version 0.1.0
* Author: JayWood
* Author URI: http://www.plugish.com
*/
@cyu
cyu / twitter_application_only_token.rb
Last active November 18, 2016 23:50
How to get a Twitter application-only bearer token#
# https://dev.twitter.com/docs/auth/application-only-auth
require 'open-uri'
require "base64"
require 'net/http'
require 'json'
CONSUMER_KEY = 'MY_CONSUMER_KEY'
CONSUMER_SECRET = 'MY_CONSUMER_SECRET'
@pepelsbey
pepelsbey / duplicates.html
Last active June 28, 2019 12:15
Removing duplicates from Liquid array
{% assign array = 'c|c|b|b|a|a' | split: '|' %}
{% assign tags = array[1] %}
{% for item in array %}
{% unless tags contains item %}
{% capture tags %}{{ tags }}|{{ item }}{% endcapture %}
{% endunless %}
{% endfor %}
{{ tags | split: '|' | sort | join: ', ' }}
@mrwweb
mrwweb / reset-rems
Created May 22, 2013 13:22
"Sanity-ize" REMs by setting them to 10px-baseline aka "Tiny Happy Pixels Dancing."
/* this is the "root" in "root em." */
html {
font-size: 62.5%; /* Now 10px = 1rem! */
}
body {
font-size: 16px; /* px fallback */
font-size: 1.6rem; /* default font-size for document */
line-height: 1.5; /* a nice line-height */
}
@MaxPower15
MaxPower15 / gist:4278527
Created December 13, 2012 18:31
Programmatically launch an existing popover on the page.
<a id="my_popover" href="http://fast.wistia.com/embed/iframe/fcf31a497a?autoPlay=true&controlsVisibleOnLoad=true&playerColor=81c2f0&popover=true&version=v1&videoHeight=360&videoWidth=640" class="wistia-popover[height=360,playerColor=81c2f0,width=640]"><img src="http://embed.wistia.com/deliveries/e45e6fd93899ef7abbbd0d1dc643e99e8d2f84d7.jpg?image_play_button=true&image_play_button_color=4991C4e0&image_crop_resized=150x84" alt="" /></a><script charset="ISO-8859-1" src="http://fast.wistia.com/static/popover-v1.js"></script>
<script>
wistiaJQuery("#my_popover").click();
</script>
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 4, 2024 17:58
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@Shadowfiend
Shadowfiend / gist:1089727
Created July 18, 2011 14:46
CSS for popup with arrow.
.popup {
position: relative;
font-size: 12px;
width: 300px;
background-color: #28C0F7;
color: white;
padding: 15px;
@briancavalier
briancavalier / simple-promise-retry.js
Created February 24, 2011 18:35
A few general patterns for retries using promises
function keepTrying(otherArgs, promise) {
promise = promise||new Promise();
// try doing the important thing
if(success) {
promise.resolve(result);
} else {
setTimeout(function() {
keepTrying(otherArgs, promise);