Skip to content

Instantly share code, notes, and snippets.

View rsadwick's full-sized avatar
🌪️
spin 2 win

Ryan Sadwick rsadwick

🌪️
spin 2 win
View GitHub Profile
@rsadwick
rsadwick / Instagram api Django View
Created April 7, 2013 17:28
Calling instagram api from Django view. Returns json to easily wire up into a js ajax call.
def get_instagram(request):
#define tag here:
tag = 'jesus'
req = urllib2.Request("https://api.instagram.com/v1/tags/" + tag + "/media/recent?access_token=TOKEN_GOES_HERE&count=50")
opener = urllib2.build_opener()
instagram = opener.open(req)
json = simplejson.load(instagram)
images = []
for image in json['data']:
images.append({'thumbnail' : image['images']['thumbnail'], 'standard' : image['images']['standard_resolution'], 'caption' : image['caption'] })
@rsadwick
rsadwick / gist:5399240
Created April 16, 2013 20:16
Open Facebook book feed dialog to post on timeline
FB.init({appId: "APP_ID_HERE", status: true, cookie: true});
$(document).ready(function() {
$('#some_btn').on('click', function(e){
e.preventDefault();
var obj = {
method: 'feed',
redirect_uri: 'YOUR URL HERE',
link: 'link_here',
picture: 'src_here',
@rsadwick
rsadwick / canvas_animation
Created July 18, 2013 15:47
Canvas animation with easel.js and tweenmax
<!DOCTYPE html>
<html>
<head></head>
<body onLoad="init();">
<p>demo</p>
<canvas id="demoCanvas" width="640" height="480">
alternate crap for junk ass users
</canvas>
@rsadwick
rsadwick / tweenmax_items.js
Created March 31, 2014 23:18
scrolling items example using greensock
$(document).ready(function(){
var scrollContainer = Gumby.$dom.find("#social-items");
var scrollEl = scrollContainer.find("li");
var padding = parseInt(scrollEl.find(".social-item").css("marginBottom"));
var height = (scrollEl.height() + padding ) * (scrollEl.length - 3);
//create tween:
var socialTween = TweenMax.to(scrollEl, 7, {css:{ top: -height + "px"},
delay: 2, ease:Sine.easeInOut, repeat: -1, repeatDelay: 1, yoyo: true});
//events:
@rsadwick
rsadwick / hashy.py
Created October 13, 2014 12:54
snags related hash tags based on query
import urllib2
from bs4 import BeautifulSoup
site_url = 'https://ritetag.com/best-hashtags-for/'
hash_tag = raw_input()
response = urllib2.urlopen(site_url + hash_tag)
html = response.read()
soup = BeautifulSoup(html)
def match_class(target):
def do_match(tag):
@rsadwick
rsadwick / exclamation.svg
Created March 29, 2018 17:25
Exclamation Mark SVG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rsadwick
rsadwick / getRemainingTime.js
Created May 17, 2023 16:27
javascript: get remaining time by seconds
function getTimeRemaining(seconds) {
const now = new Date();
// Add the specified number of seconds to the current time
now.setSeconds(now.getSeconds() + seconds);
const current = new Date();
let diffInMinutes = Math.floor((now - current) / 60000);
let hours = Math.floor(diffInMinutes / 60);
@rsadwick
rsadwick / deepseek.txt
Created February 4, 2025 17:31
DeepSeek template
<context>
You are an expert programming AI assistant who prioritizes minimalist, efficient code. You plan before coding, write idiomatic solutions, seek clarification when needed, and accept user preferences even if suboptimal.
</context>
<planning_rules>
Create 3-step numbered plans before coding Display current plan step clearly Ask for clarification on ambiguity Optimize for minimal code and overhead