Skip to content

Instantly share code, notes, and snippets.

View fokosun's full-sized avatar
:octocat:
I may be slow to respond.

fokosun fokosun

:octocat:
I may be slow to respond.
View GitHub Profile
@fokosun
fokosun / bWAPP easy setup
Last active December 19, 2018 15:55
setup bWAPP without WAMP or XAMPP or any Virtual machine
Important Note: PHP Version must be < version 5.5 if you are using version 7.0
you will need to use a VM like bee-box so you can have an isolated installation of PHP5.4 installed
Download and install bee-box: https://sourceforge.net/projects/bwapp/files/bee-box/
Download bWAPP: http://www.itsecgames.com/
Unzip the downloaded zipped folder
SETUP DATABASE:
@Tusko
Tusko / jquery.ajax.js
Last active November 12, 2021 02:54
$.ajax Promise
/*
* ajax Defaults (optional):
$.ajaxSetup({
type : 'POST',
dataType : 'json',
cache : true,
global : true,
data : {},
contentType : 'application/json',
beforeSend : function (xhr) {
@mchelen
mchelen / index.php
Last active November 20, 2021 18:01
php check multidimensional array for duplicate values
<?php
$arrays = array(
array(
'name'=>'foo',
),
array(
'name'=>'bar',
),
array(
'name'=>'foo',
@developerdino
developerdino / ThrottleRequests.php
Created February 16, 2016 04:12
Lumen Middleware for rate limiting - based on Laravel's implementation.
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Response;
use Illuminate\Cache\RateLimiter;
class ThrottleRequests
{
@fokosun
fokosun / amendrecentcommitmsg
Created December 20, 2015 20:19
Amend most recent commit message
git commit --amend -m "your new message"
<div class="tweet original-tweet js-stream-tweet js-actionable-tweet js-profile-popup-actionable js-original-tweet
" data-feedback-key="stream_status_374123416800206848" data-tweet-id="374123416800206848" data-item-id="374123416800206848" data-screen-name="dboudreau" data-name="Denis Boudreau " data-user-id="10096552" data-is-reply-to="true" data-has-parent-tweet="true" data-expanded-footer="&lt;div class=&quot;js-tweet-details-fixer tweet-details-fixer&quot;&gt;
&lt;div class=&quot;js-tweet-media-container &quot;&gt;&lt;/div&gt;&lt;div class=&quot;entities-media-container &quot; style=&quot;min-height:0px&quot;&gt;&lt;/div&gt;
&lt;div class=&quot;js-machine-translated-tweet-container&quot;&gt;&lt;/div&gt;
&lt;div class=&quot;js-tweet-stats-container tweet-stats-container &quot;&gt;
&lt;/div&gt;&lt;div class=&quot;client-and-actions&quot;&gt;
&lt;span class=&quot;metadata&quot;&gt;
&lt;span title=&quot;11:55 AM - 1 Sep 13&quot;&gt;11:55 AM - 1 Sep 13&lt;/span&gt;
&amp;middot; &lt;a class=&quot;permalink-lin
@cosmocatalano
cosmocatalano / instagram_scrape.php
Last active August 6, 2023 07:32
Quick-and-dirty Instagram web scrape, just in case you don't think you should have to make your users log in to deliver them public photos.
<?php
//returns a big old hunk of JSON from a non-private IG account page.
function scrape_insta($username) {
$insta_source = file_get_contents('http://instagram.com/'.$username);
$shards = explode('window._sharedData = ', $insta_source);
$insta_json = explode(';</script>', $shards[1]);
$insta_array = json_decode($insta_json[0], TRUE);
return $insta_array;
}
@jonathanmoore
jonathanmoore / gist:2640302
Created May 8, 2012 23:17
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter