Skip to content

Instantly share code, notes, and snippets.

View aaronpk's full-sized avatar

Aaron Parecki aaronpk

View GitHub Profile
@aaronpk
aaronpk / helloworld.js
Created August 10, 2012 18:12
Hello World
[][(![]+[])[!+[]+!![]+!![]]+({}+[])[+!![]]+(!![]+[])[+!![]]+(!![]+[])[+[]]][({}+[])[!+[]+!![]+!![]+!![]+!![]]+({}+[])[+!![]]+([][+[]]+[])[+!![]]+(![]+[])[!+[]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([][+[]]+[])[+[]]+({}+[])[!+[]+!![]+!![]+!![]+!![]]+(!![]+[])[+[]]+({}+[])[+!![]]+(!![]+[])[+!![]]]([][(![]+[])[!+[]+!![]+!![]]+({}+[])[+!![]]+(!![]+[])[+!![]]+(!![]+[])[+[]]][({}+[])[!+[]+!![]+!![]+!![]+!![]]+({}+[])[+!![]]+([][+[]]+[])[+!![]]+(![]+[])[!+[]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([][+[]]+[])[+[]]+({}+[])[!+[]+!![]+!![]+!![]+!![]]+(!![]+[])[+[]]+({}+[])[+!![]]+(!![]+[])[+!![]]]((!![]+[])[+!![]]+([][+[]]+[])[!+[]+!![]+!![]]+(!![]+[])[+[]]+([][+[]]+[])[+[]]+(!![]+[])[+!![]]+([][+[]]+[])[+!![]]+({}+[])[!+[]+!![]+!![]+!![]+!![]+!![]+!![]]+([][+[]]+[])[+[]]+([][+[]]+[])[+!![]]+([][+[]]+[])[!+[]+!![]+!![]]+(![]+[])[!+[]+!![]+!![]]+({}+[])[!+[]+!![]+!![]+!![]+!![]]+(+{}+[])[+!![]]+([]+[][(![]+[])[!+[]+!![]+!![]]+({}+[])[+!![]]+(!![]+[])[+!![]]+(!![]+[])[+[]]][({}+[])[!+[]+!![]+!![]+!![]+!![]]+({}+
[LQSession registerForPushNotificationsWithCallback:^(NSData *deviceToken, NSError *error) {
if(error){
NSLog(@"Failed to register for push notifications: %@", error);
} else {
NSLog(@"Got a push token! %@", deviceToken);
}
}];
<a class="h-card vcard url u-url" href="https://brennannovak.com">
<img src="https://twimg0-a.akamaihd.net/profile_images/1890414952/9c14e66468a411e1989612313815112c_7_normal.jpg" alt="" class="u-photo photo">
<span class="p-name fn">Brennan Novak</span>
</a>
@aaronpk
aaronpk / indieauth-client.php
Created September 9, 2012 16:44
Simple PHP example of using the indieauth.com API
<?php
session_start();
if(array_key_exists('token', $_GET)) {
// Verify the token with indieauth.com
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://indieauth.com/session?token=' . $_GET['token']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$auth = json_decode(curl_exec($ch));
// If we got a reply, store the domain in the session
@aaronpk
aaronpk / payload.json
Created September 11, 2012 00:27
Example payload sent to callback URL
{
"layer":{
"bounds":{
"center":{
"latitude":45.521740823313,
"longitude":-122.68043538074
},
"map":"http://map.geoloqi.com/45.521752557438,-122.68041864527?radius=546.45073462403",
"ne":{
"latitude":45.524569933375,
<?php
class ServiceHelper {
// @text is the full tweet text
// @shortCode is the code part of the shortlink, like nXXX0
public function shortenForTwitter($text, $shortCode=FALSE, $shortDomain=FALSE) {
$placeholders = array();
$rawTweet = $text;
@aaronpk
aaronpk / gist:3933002
Created October 22, 2012 18:00
simple example of importing a dataset
request = Chimps::QueryRequest.new('encyclopedic/wikipedia/dbpedia/wikipedia_articles/search',
:query_params => {
'g.radius' => 5000,
'g.latitude' => location['location']['position']['latitude'],
'g.longitude' => location['location']['position']['longitude']
})
data = JSON.parse response.body
data['results'].each{|article|
geoloqi.post 'trigger/create', {
@aaronpk
aaronpk / auto-update.sh
Created October 29, 2012 17:02
Automatically update a git repo from "staging" branch and restart website if needed
#!/bin/bash
output=`git pull origin staging`
echo $output
if [ "$output" != "Already up-to-date." ]; then
git submodule update
touch tmp/restart.txt
echo Restarting Website
fi
@aaronpk
aaronpk / app.rb
Created November 28, 2012 12:07 — forked from troelskn/app.rb
Gollum protected by HTTP Basic
require 'gollum/frontend/app'
require 'digest/sha1'
class App < Precious::App
User = Struct.new(:name, :email, :password_hash)
before { authenticate! }
helpers do
def authenticate!
@aaronpk
aaronpk / gist:5694138
Created June 2, 2013 16:58
Preventing MediaWiki spam
// Garbee suggests the following settings in LocalSettings.php to help prevent bot spam:
// Number of edits an account requires before it is autoconfirmed
// http://www.mediawiki.org/wiki/Manual:$wgAutoConfirmCount
$wgAutoConfirmCount = 1;
// Number of seconds an account is required to age before it's given the implicit 'autoconfirmed' group membership.
// Note that the user must pass $wgAutoConfirmAge and $wgAutoConfirmCount to become a member of that group.
// http://www.mediawiki.org/wiki/Manual:$wgAutoConfirmAge
$wgAutoConfirmAge = 86400; // one day