Skip to content

Instantly share code, notes, and snippets.

View maurerbot's full-sized avatar

Adrian maurerbot

View GitHub Profile
@maurerbot
maurerbot / Questions
Created September 6, 2011 20:44
GOTO Amsterdam
Day job:
Web Application Developer
What is your language of choice:
PHP
Open Source contributions:
Some js classes
How do you use GitHub:
At work and for personal projects.
@maurerbot
maurerbot / mutualTwitterFriends.php
Created January 10, 2012 23:14
PHP Script to get Twitter mutual relationship ids and their user details
//sharing this logic because twitter doesn't give you and end point to get mutual relationships (uses zend mvc framework for requests but it is easy enough to use something else to make the API requests)
//note: $this->source variable is a standard object that holds access token and user information for the user doing the requests
$cursor = -1; //initial position for twitter API friends and follower endpoint (important for users with more then 5000 followers/friends)
do {
//get the first 5000 following ids
$client = new Zend_Http_Client;
$client->setUri('https://api.twitter.com/1/friends/ids.json');
@maurerbot
maurerbot / object-watch.js
Created June 14, 2012 16:29 — forked from eligrey/object-watch.js
object.watch polyfill
/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
@maurerbot
maurerbot / C++.sublime-build
Created June 20, 2012 23:27
Getting Sublime Text to build a C file.
{
"cmd": ["g++", "$file", "-o", "$file_base_name", "-I/usr/local/include"],
"selector": "source.c++",
"windows":
{
"cmd": ["cl", "/Fo${file_path}", "/O2", "$file"]
}
}
@maurerbot
maurerbot / gist:3138076
Created July 18, 2012 18:56 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@maurerbot
maurerbot / manifest_generator.sh
Last active December 10, 2015 20:18
HTML5 Manifest Generator and Watcher
#!/bin/bash
#This script watches your project folder and outputs a HTML5 Manifest to $OUT
#You may need to change the location of your depency scripts
#Dependencies: confess.js and phantomjs
#Usage: sh manigest_generator.sh <url> <dir>
#Author Adrian Maurer (https://github.com/adrianmaurer)
#Based on http://stackoverflow.com/questions/2972765/linux-script-that-monitors-file-changes-within-folders-like-autospec-does
#sh manifest_generator.sh $URL $DIR $OUT
""""Create "The Matrix" of binary numbers scrolling vertically in your terminal.
original code adapted from juancarlospaco:
- http://ubuntuforums.org/showpost.php?p=10306676
Inspired by the movie: The Matrix
- Corey Goldberg (2013)
Requires:
@maurerbot
maurerbot / MeetupAuthActivity.java
Last active January 12, 2017 04:46
Created this to authenticate meetup for an android app.
import android.content.ContentValues;
import android.net.Uri;
import android.os.AsyncTask;
import android.util.Log;
import android.view.Window;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;
// leeloo oAuth lib https://bitbucket.org/smartproject/oauth-2.0/wiki/Home
@maurerbot
maurerbot / GravitationalPull.cs
Last active August 21, 2018 19:40
Gravitational pull in Unity
// Get all the objects in range
Collider[] cols = Physics.OverlapSphere(transform.position, range);
// Assign the first object as the nearest for now
Collider nearest = cols[0];
// Loop through objects
foreach (Collider c in cols)
{
// Get the current objects rigidbody
Rigidbody rb = c.attachedRigidbody;
@maurerbot
maurerbot / gist:f9a302b7400531ea8efd
Last active August 29, 2015 14:01
Fancy Bash Git Prompt
curl https://raw.github.com/git/git/master/contrib/completion/git-prompt.sh -o ~/.git-prompt.sh`

update your ~/.bash_profile

PS1='\[\033[0;32m\]┌┼─┼─ \[\033[0m\033[0;32m\]\u\[\033[0m\] @ \[\033[0;36m\]\h\[\033[0m\033[0;32m\] ─┤├─ \[\033[0m\]\t \d\[\033[0;32m\] ─┤├─ \[\033[0;31m\]\w\[\033[0;32m\] ─┤\[$(__git_ps1)\]\n\[\033[0;32m\]└┼─\[\033[0m\033[0;32m\]\$─┤▶\[\033[0m\] '