Skip to content

Instantly share code, notes, and snippets.

View cuongdcdev's full-sized avatar
🔥
👷🔨🪚💻

Cuong DC cuongdcdev

🔥
👷🔨🪚💻
View GitHub Profile
@cuongdcdev
cuongdcdev / facebook-mass-delete-group-members.js
Created February 3, 2018 11:15 — forked from michaelv/facebook-mass-delete-group-members.js
This javascript removes all users from a facebook group. It works with the new facebook layout. Paste this in the javascript console. Script tested in Firefox. Known issues: 1. when facebook responds slowly, the script might experience hickups.. 2. occasionially, the error 'this user is not a member of the group' pops up.. IMPORTANT: add your ow…
var deleteAllGroupMembers = (function () {
var deleteAllGroupMembers = {};
// the facebook ids of the users that will not be removed.
// IMPORTANT: add your own facebook id here so that the script will not remove yourself!
var excludedFbIds = ['1234','11223344']; // make sure each id is a string!
var usersToDeleteQueue = [];
var scriptEnabled = false;
var processing = false;
deleteAllGroupMembers.start = function() {
<?php
// Amazon S3 SDK v2.8.27
// http://aws.amazon.com/de/sdkforphp2/
// https://github.com/aws/aws-sdk-php
// http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region
/**
* Documentation: http://docs.amazonwebservices.com/aws-sdk-php-2/latest/class-Aws.S3.S3Client.html
*/
class BackWPup_Destination_S3 extends BackWPup_Destinations {
@cuongdcdev
cuongdcdev / index.htm
Created March 12, 2018 09:31 — forked from AllThingsSmitty/index.htm
Simple responsive table in CSS (no JS)
<table>
<thead>
<tr>
<th>Payment</th>
<th>Issue Date</th>
<th>Amount</th>
<th>Period</th>
</tr>
</thead>
<tbody>
@cuongdcdev
cuongdcdev / blog.md
Created March 23, 2018 04:26 — forked from JacobBennett/blog.md
API Token Authentication in Laravel 5.2 & 5.3

I recently had the need to write a small url shortening application. I am aware that this problem has been solved quite a few times before, but what is being a developer if not reinventing the wheel just for the heck of it? Custom CMS anyone?

Knowing that this was going to be a tiny RESTful API and also knowing that Laravel 5.2 had API rate limiting built in, I was eager to give it a try. Taylor Otwell being Taylor Otwell shipped 5.2 with the rate limiting defaults set up out of the box and I had my application building out short url's in a matter of minutes. The problem for me came when I wanted to start associating those short urls with a user.

Typically my applications have a UI and authentication is done through a simple login page. Obviously for a RESTful API, having a login page isn't ideal. Instead, my hope was to have users append an api_token to the end of their query string and use that to auth

<?php
/**
* Folder Downloader
*
* @package Inpsyde\BackWPup
*/
/**
* Class BackWPup_Destination_Folder_Downloader
*
@cuongdcdev
cuongdcdev / gist:d8df27c7453331ddeb7bd593154d8a97
Created August 17, 2018 11:29
Replace class-create-archive.php content
<?php
/**
* Create Archive
*/
/**
* Class for creating File Archives
*/
class BackWPup_Create_Archive {
@cuongdcdev
cuongdcdev / VideoStream.php
Created September 7, 2018 09:53 — forked from ranacseruet/VideoStream.php
PHP VideoStream class for HTML5 video streaming
<?php
/**
* Description of VideoStream
*
* @author Rana
* @link http://codesamplez.com/programming/php-html5-video-streaming-tutorial
*/
class VideoStream
{
private $path = "";
<?php
/**
* Create Archive
*/
/**
* Class for creating File Archives
*/
class BackWPup_Create_Archive {
@cuongdcdev
cuongdcdev / class-job.php
Created November 27, 2018 12:27
hotfix for config.php file not included on BWU 3.6.5
<?php
/**
* Class in that the BackWPup job runs
*/
final class BackWPup_Job {
const ENCRYPTION_SYMMETRIC = 'symmetric';
const ENCRYPTION_ASYMMETRIC = 'asymmetric';
@cuongdcdev
cuongdcdev / download large file with php
Created December 11, 2018 06:43 — forked from damienalexandre/tool.php
Download large file from the web via php
<?php
/**
* Download a large distant file to a local destination.
*
* This method is very memory efficient :-)
* The file can be huge, PHP doesn't load it in memory.
*
* /!\ Warning, the return value is always true, you must use === to test the response type too.
*
* @author dalexandre