Skip to content

Instantly share code, notes, and snippets.

View danwaz's full-sized avatar

Dan Wasilewski danwaz

View GitHub Profile
@danwaz
danwaz / Default (OSX).sublime-mousemap
Last active October 6, 2017 15:08
Ctrl+click Goto Definition shortcut for Sublime Text 3 (OSX)
// Place the following in ~/Library/Application Support/Sublime Text 3/Packages/User/Default (OSX).sublime-mousemap
[
{
"button": "button1",
"count": 1,
"modifiers": ["ctrl"],
"press_command": "drag_select",
"command": "goto_definition"
}
]
@danwaz
danwaz / GetAllBrandLocations
Last active December 26, 2015 21:49
Query Facebook for all Brand Locations
/*
Query Facebook for all Brand Locations
*/
//Graph API query - https://developers.facebook.com/tools/explorer/?method=GET
{page_id}/locations?fields=checkins,likes,location,were_here_count,link,talking_about_count
//Using Curl
@danwaz
danwaz / config.rb
Created August 5, 2013 17:40
Compass config.rb setup for Wordpress
# Require any additional compass plugins here.
require "susy"
require 'fileutils'
require 'sass-globbing'
# Set this to the root of your project when deployed:
http_path = "/wp-content/themes/YOUR_THEME/"
css_dir = "css"
sass_dir = "sass"
images_dir = "img"
@danwaz
danwaz / post-receive
Created July 25, 2013 23:04
Post Receive Hook Example .git/hooks/post-receive
#!/bin/bash
GIT_WORK_TREE=/path/to/project/web_root git checkout -f
@danwaz
danwaz / format_tweet.php
Last active December 20, 2015 04:49
Format Tweet PHP
<?php
function format_tweet($tweet_obj){
//create an array of tweet entities
$entity_arr = array();
$formatted_text = $tweet_obj['text'];
foreach($tweet_obj['entities'] as $entity){
foreach($entity as $item){
$entity_arr[] = $item;
}
@danwaz
danwaz / counting-animation
Last active December 20, 2015 00:29
Counting Animation
var counterAnimation = function($num, to, from){
var totalTime = 250,
direction = to - from,
counter = 0,
interval = 6,
iterator = (Math.abs(to-from)) / (Math.round(totalTime/interval));
var _endCount = function(){
clearInterval(counterInterval);
$num.html(Math.round(to));
@danwaz
danwaz / webkit-thin-font.css
Created April 4, 2013 18:01
Prevent thin font rendering in Webkit
*{
position:relative;
z-index:1
}
@danwaz
danwaz / gist:3752702
Created September 19, 2012 22:18
Convert JSON to YAML
#!/bin/bash
# Converts a directory of JSON files into YAML files! Cool!
# Requires json2yaml node package https://npmjs.org/package/json2yaml
# receive the directory or treat current directory as the base directory
DIR=$1
if [ -d $DIR ]; then
cd $DIR;
echo $PWD;
@danwaz
danwaz / formatTweet.js
Last active October 7, 2015 20:17
Format Tweet
/*
* Dan Wasilewski
*
* A simple function that formats a tweet's text to include linked entities (hashtag, mentions, and links)
* When fetching tweets, make sure to add include_entities=1 to your query string
*
*/
var formatTweet = function(tweetObj){
//create an array of tweet entities