Skip to content

Instantly share code, notes, and snippets.

View elliotforbes's full-sized avatar
:octocat:

Elliot Forbes elliotforbes

:octocat:
View GitHub Profile
<?php
/**
* The application's route middleware.
*
* @var array
*/
protected $routeMiddleware = [
'auth' => 'App\Http\Middleware\Authenticate',
'auth.basic' => 'Illuminate\Auth\Middleware\AuthenticateWithBasicAuth',
'guest' => 'App\Http\Middleware\RedirectIfAuthenticated',
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$user = \Auth::user();
$userCount = User::count();
if($this->isAdmin())
import org.lwjgl.Sys;
import org.lwjgl.glfw.*;
import org.lwjgl.opengl.*;
import java.nio.ByteBuffer;
import static org.lwjgl.glfw.Callbacks.*;
import static org.lwjgl.glfw.GLFW.*;
import static org.lwjgl.opengl.GL11.*;
<?php
class ArticleController extends Controller {
public function index()
{
$articles = Article::get();
return view('someview', compact('articles'));
}
<?php
class ArticleController extends Controller {
public function index()
{
$articles = Article::paginate(15);
return view('someview', compact('articles'));
}
}
@foreach ($articles as $article)
{{ $article->id }}
{{ $article->title }}
{{ $article->published }}
@endforeach
echo $articles->render();
from twitter import Twitter, OAuth, TwitterHTTPError
consumer_key = ''
consumer_secret = ''
access_token_key = ''
access_token_secret = ''
bot = Twitter(auth=OAuth(access_token_key, access_token_secret,
consumer_key, consumer_secret))
def search_tweets(query, count=100):
return bot.search.tweets(query=query, result_type='recent', count=count)
def auto_fav(q, count):
# create an array of tweets of length = count
# that contain the string q.
result = search_tweets(q, count)
# parses the results and gets the
a = result['statuses'][0]['user']['screen_name']
print a
success = 0
for tweet in result['statuses']:
if fav_tweet(tweet) is not None: