This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Display a listing of the resource. | |
* | |
* @return Response | |
*/ | |
public function index() | |
{ | |
$user = \Auth::user(); | |
$userCount = User::count(); | |
if($this->isAdmin()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.*; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ArticleController extends Controller { | |
public function index() | |
{ | |
$articles = Article::get(); | |
return view('someview', compact('articles')); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ArticleController extends Controller { | |
public function index() | |
{ | |
$articles = Article::paginate(15); | |
return view('someview', compact('articles')); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@foreach ($articles as $article) | |
{{ $article->id }} | |
{{ $article->title }} | |
{{ $article->published }} | |
@endforeach |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo $articles->render(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def search_tweets(query, count=100): | |
return bot.search.tweets(query=query, result_type='recent', count=count) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |