Skip to content

Instantly share code, notes, and snippets.

View fahdi's full-sized avatar

Fahad Murtaza fahdi

View GitHub Profile
@JMSwag
JMSwag / Flask-Restful_S3_File_Upload.py
Created April 30, 2016 22:43 — forked from RishabhVerma/Flask-Restful_S3_File_Upload.py
Uploading a file to S3 while using Flask with Flask-Restful to create a REST API.
# -*- coding: utf-8 -*-
"""
An example flask application showing how to upload a file to S3
while creating a REST API using Flask-Restful.
Note: This method of uploading files is fine for smaller file sizes,
but uploads should be queued using something like celery for
larger ones.
"""
from cStringIO import StringIO
@bordoni
bordoni / functions.php
Created February 5, 2015 04:37
How to add the Venue on The Events Calendar Month Tooltip
<?php
/*
* If you already have something in your functions.php, please remove these first few lines
*/
function tec_forum_939516( $json, $event, $additional ){
$venue = tribe_get_venue_id( $event );
if ( $venue ){
$json['venue'] = $venue;
@grant-roy
grant-roy / update-jekyll
Last active March 28, 2024 10:45
Bash script to poll Github and rebuild and restart a jekyll site
#!/bin/sh
#This is a simple bash script that will poll github for changes to your repo,
#if found pull them down, and then rebuild and restart a Jekyll site running
#in Nginx. Note, we cannot use cron to schedule a job every 5 seconds, so we create
#a script that executes an infinite loop that sleeps every 5 seconds
#We run the script with nohup so it executes as a background process: $nohup ./update-jekyll
while true
do
@macbleser
macbleser / wp-permissions-script
Created February 21, 2014 15:37
WordPress Permissions Configuration Script
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro
#
WP_OWNER=changeme # &lt;-- wordpress owner
WP_GROUP=changeme # &lt;-- wordpress group
WP_ROOT=/home/changeme # &lt;-- wordpress root directory
@fahdi
fahdi / json_file.json
Last active December 28, 2015 19:49
Update HTML drop down with JSON file with an AJAX request
{ "options": [ {"value": "New1", "text": "New Option 1"}, {"value": "New2", "text": "New Option 2"}, {"value": "New3", "text": "New Option 3"} ] }
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title> - jsFiddle demo by fahdi</title>
<script type='text/javascript' src='//code.jquery.com/jquery-1.9.1.js'></script>
<!-- 1. Take your Campaign Monitor subscribe form as generated from within your account: -->
<form action="http://myaccount.createsend.com/t/r/s/aljhk/" method="post" id="subForm">
<div>
<label for="name">Name:</label><br /><input type="text" name="cm-name" id="name" /><br />
<label for="aljhk-aljhk">Email:</label><br /><input type="text" name="cm-aljhk-aljhk" id="aljhk-aljhk" /><br />
<input type="submit" value="Subscribe" />
</div>
</form>
@anchetaWern
anchetaWern / laravel-ums.markdown
Created December 6, 2012 11:14
Building a User Management System in Laravel

There's no shortage of good resources for learning laravel. So instead of the usual introductory tutorial were just gonna learn Laravel by building a project from scratch and that's gonna be a User Management System.

I don't know if my definition of a User Management System is correct but here's my idea of what's it's capable of doing:

  • Register Roles
  • Register Users
  • Update Users
@jexchan
jexchan / multiple_ssh_setting.md
Created April 10, 2012 15:00
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@stelabouras
stelabouras / downloadFromBasecamp.php
Last active February 27, 2020 14:06
Download all your file from Basecamp and organise them in folders
<?
// make sure the folder of the script is writeble (0777)
$basecampUrl = '[YOUR BASECAMP URL HERE]'; // e.g. https://stelabouras.basecamphq.com/ (Don't forget the trailing slash!)
$apiKey = '[YOUR API KEY HERE]'; // e.g. one huge string (found in 'My info' in the Authentication tokens section)
function BasecampCall($endPoint, $usePrefix = true) {
global $apiKey, $basecampUrl;
// From: http://prattski.com/2008/10/22/basecamp-api-examples-using-php-and-curl-get/