Skip to content

Instantly share code, notes, and snippets.

View kitsunde's full-sized avatar
💭
Poisoning pigeons in the park

Kit Sunde kitsunde

💭
Poisoning pigeons in the park
View GitHub Profile
@kitsunde
kitsunde / closethread.py
Created July 16, 2013 08:49
Disqus owner cannot close threads.
>>> PUBLIC_KEY = 'TkhL2k0lvpvb5KIiN8l0E1tcMAEguAXy8rPOheJfwkjUGdrWLZSJIr2Mv2Dnyhy1'
>>> SECRET_KEY = 'notmykey'
>>> ACCESS_TOKEN = 'alsonotmykey'
>>> disqus = DisqusAPI(SECRET_KEY, PUBLIC_KEY)
>>> disqus.users.details(access_token=ACCESS_TOKEN)
{'favicon': {'cache': 'https://securecdn.disqus.com/1373918630/images/favicon-default.png',
'permalink': 'https://disqus.com/api/forums/favicons/transformbusiness.jpg'},
'founder': '61541387',
'id': 'transformbusiness',
upstream cuteletter{
server 127.0.0.1:8000;
}
server {
listen 80;
listen 9001 default_server;
server_name www.cuteandfluffythings.com cuteandfluffythings.com;
access_log /var/log/nginx/cuteletter.access.log;
var collidables = new Collidables();
function GameObject(){
var x = 0;
var y = 0;
var width = 100;
var height = 100;
this.collidable = new Collidable({
bounds: function(){
var collidables = new Collidables();
function GameObject(){
this.collidable = new Collidable({
get: function(){
return new BoundingBox(this.x,
this.y,
this.x + this.width,
this.y + this.height);
},
<script>
FB.getLoginStatus(function(response){
if (response.status !== 'connected') { // User is not authed in.
top.location.href='https://www.facebook.com/dialog/oauth?'
+ 'client_id=522323317786421'
+ '&scope=publish_actions'
+ '&redirect_uri=https%3A%2F%2Fapps.facebook.com%2Feconavi%2Fredirect.php'
+ '&state=93300ac5f310956db957a99869ec8fab';
}
});
#Build a date range with the start of the previous/upcomming months.
now = timezone.now()
current_date = now.date()
months = []
for month_adjust in range(-2, 3):
month = (now.month + month_adjust) % 12
if month == 0: month = 12
months.append(current_date.replace(month=month, day=1))
@kitsunde
kitsunde / gist:4141184
Created November 24, 2012 19:50
remove whitespace from dirs if there's no file named .lut in the dir
#!/usr/bin/python
def de_specify_dirs():
import os
for dir in os.listdir('./'):
if not os.path.isdir(dir): continue
path = os.path.join('./', dir)
if [ file for file in os.listdir(path) if file.endswith('.lut') ]:
continue
os.rename(path, path.replace(' ', '_'))
if (!Date.prototype.toISOString) {
Date.prototype.toISOString = function() {
function pad(n) { return n < 10 ? '0' + n : n }
return this.getUTCFullYear() + '-'
+ pad(this.getUTCMonth() + 1) + '-'
+ pad(this.getUTCDate()) + 'T'
+ pad(this.getUTCHours()) + ':'
+ pad(this.getUTCMinutes()) + ':'
+ pad(this.getUTCSeconds()) + 'Z';
};
import cProfile
def conditions_test(a):
if a == 1 or a == 2 or a == 3 or a == 4:
return
return
def in_test(a):
if a in (1, 2, 3, 4):
@kitsunde
kitsunde / gist:3749572
Created September 19, 2012 13:10
Fancy movement logics.
function checkMovementOrSomething(){
var $element = $("thingy");
var movementActions = [
{target: 'wall', callback: function(game){ return false; }}
{target: 'ghost', callback: function(game){if(!game.hasPowerUp()){game.gameOver(); return false;}}},
{target: 'bubble', callback: function(game){game.points++;game.removeBubble(x, y)}}
{target: 'power-up', callback: function(game){game.setPowerUp(true);}}
];
for(var i=0; i< movementActions.length;i++){
var action = movementActions[i];