Skip to content

Instantly share code, notes, and snippets.

View cgallagher's full-sized avatar

Chris Gallagher cgallagher

View GitHub Profile
@cgallagher
cgallagher / gist:5293000
Last active December 15, 2015 16:59
FQL to find your friends who have iPhones or iOS devices in the Graph API
//find all friends with iOS devices
SELECT uid, name, devices FROM user
WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me())
AND "iOS" IN devices
ORDER BY profile_update_time DESC
LIMIT 0, 100
//find friends with iPhones
@cgallagher
cgallagher / traffikr.rb
Last active December 20, 2015 03:19
Not really production ready code in any sense of the word but will build up an ad and point it at a facebook custom audience... you can also generate a lookalike audience if you're bothered.
# not production code - just a bunch of calls that run through the process of creating an ad and pointing it at a custom audience on Facebook.
class Traffikr
cattr_accessor :custom_audience_id, :access_token, :users_json, :account_id, :campaign_id, :image_hash, :creative_id
class << self
<script src="//platform.twitter.com/oct.js" type="text/javascript"></script>
<script type="text/javascript">twttr.conversion.trackPid('<PIXEL_ID_HERE>', { tw_product_id: '<SKU_ID_HERE>', tw_country_code: '<ISO_COUNTRY_CODE_HERE>' });</script>
<noscript>
<img height="1" width="1" style="display:none;" alt="" src="https://analytics.twitter.com/i/adsct?txn_id=<PIXEL_ID_HERE>&p_id=Twitter&tw_product_id=<SKU_ID_HERE>&tw_country_code=<ISO_COUNTRY_CODE_HERE>" />
<img height="1" width="1" style="display:none;" alt="" src="//t.co/i/adsct?txn_id=<PIXEL_ID_HERE>&p_id=Twitter&tw_product_id=<SKU_ID_HERE>&tw_country_code=<ISO_COUNTRY_CODE_HERE>" />
</noscript>
@cgallagher
cgallagher / index.html
Created October 2, 2018 14:48
Konva Image Demo // source https://jsbin.com/gatibubelo
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.rawgit.com/konvajs/konva/2.4.0/konva.min.js"></script>
<meta charset="utf-8">
<title>Konva Image Demo</title>
<style>
body {
margin: 0;
padding: 0;