Skip to content

Instantly share code, notes, and snippets.

View ahmed1490's full-sized avatar

Ahmed Abbas ahmed1490

View GitHub Profile
@fxsjy
fxsjy / SimpleAuthServer.py
Created April 26, 2013 06:23
SimpleAuthServer: A SimpleHTTPServer with authentication
import BaseHTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
import sys
import base64
key = ""
class AuthHandler(SimpleHTTPRequestHandler):
''' Main class to present webpages and authentication. '''
def do_HEAD(self):
@anointed
anointed / description.txt
Last active March 1, 2016 17:48
jquery countdown timer that replaces a slider with a live video player upon countdown completion.
This is a livecountdown timer jquery script. The concept is simple.
1. I have a slider on my homepage that when the counter is counting down shows the slider
2. when the countdown timer hits zero, then the slider div is hidden and the video div is displayed in it's place.
The primary jquery file livecountdown.js basically does 2 things:
1. the countdown timer itself is wrapped in a div ".live_countdown" When the timer is counting down then the ".live_countdown" is displayed, when the countdown timer hits zero, then the ".live_countdown" is faded out to display none
*That basically takes care of displaying the timer and removing the timer when it hits zero.
**alternately instead of hiding the timer, I can just as easily replace the timer with a 'now playing' graphic or something like that
2. The slider carousel is wrapped in a div ".stepcarousel" This slider is displayed while the countdown timer is greater than zero or still counting down
@lukeasrodgers
lukeasrodgers / GridFilteringExtensions.js
Created April 24, 2013 20:47
Extensions to Ext.grid.GridPanel to make it easier to do programmatically hook into grid filtering.
Ext.grid.GridPanel.prototype.getFeatures = function() {
return this.view.featuresMC;
};
Ext.grid.GridPanel.prototype.getFilters = function() {
var features = this.getFeatures();
if (features && features.items) {
for (var i = 0; i < features.items.length; i++) {
if (features.items[i].ftype === 'filters') {
return features.items[i];
var express = require('express');
var sys = require('util');
var oauth = require('oauth');
var app = express.createServer();
var _twitterConsumerKey = process.env['TWITTER_CONSUMER_KEY'];
var _twitterConsumerSecret = process.env['TWITTER_CONSUMER_SECRET'];
console.log("_twitterConsumerKey: %s and _twitterConsumerSecret %s", process.env['TWITTER_CONSUMER_KEY'], process.env['TWITTER_CONSUMER_SECRET']);
@tanookiben
tanookiben / BalancedPayments.md
Last active December 15, 2015 19:39
Minimum required components needed to set up a Balanced Payment (balancedpayments.com) marketplace.

Getting Balanced Payments up and running.

Files

  • balanced_controller.rb
  • _bank_account_form.html.haml
  • _credit_card_form.html.haml
  • bank_account_submission.js
  • credit_card_submission.js
@ryansobol
ryansobol / gist:5252653
Last active February 23, 2025 06:28
15 Questions to Ask During a Ruby Interview

Originally published in June 2008

When hiring Ruby on Rails programmers, knowing the right questions to ask during an interview was a real challenge for me at first. In 30 minutes or less, it's difficult to get a solid read on a candidate's skill set without looking at code they've previously written. And in the corporate/enterprise world, I often don't have access to their previous work.

To ensure we hired competent ruby developers at my last job, I created a list of 15 ruby questions -- a ruby measuring stick if you will -- to select the cream of the crop that walked through our doors.

What to expect

Candidates will typically give you a range of responses based on their experience and personality. So it's up to you to decide the correctness of their answer.

@josheinstein
josheinstein / index.html
Created March 5, 2013 18:24
A CodePen by Josh Einstein. Keyboard Navigation in Table Cells - Uses jQuery to enable arrow key functionality in tables. Pressing up/down/left/right in input fields will move focus to adjacent cells. Doesn't currently deal with column spans or custom input scenarios such as on-the-fly input fields.
<table id="people">
<thead>
<th>First Name</th>
<th>Last Name</th>
<th>Phone Number</th>
<th>Location</th>
</thead>
<tbody>
<tr>
<td><input /></td>
@cuppster
cuppster / template.js
Last active October 11, 2023 20:06
Template backbone.js code that encapsulates a datatable.net table within a view for a hypothetical auction listings application.
/*
* Template backbone.js code that encapsulates a
* datatable.net table within a view for a hypothetical ;)
* auction listings application.
*/
var HomeRouter = Backbone.Router.extend({
routes: {
'refresh' : 'refresh',
@romansklenar
romansklenar / README.md
Last active July 11, 2023 23:12
Rails concerns

What is it?

Collection of concerns for your Rails application

Installation

Copy to your app/models/concerns directory

@JamieMason
JamieMason / is_installed.sh
Last active February 17, 2024 10:12
Check if a program exists from a bash script.Thanks to twitter.com/joshnesbitt and twitter.com/mheap for the help with detecting npm packages.
#!/bin/bash
# Functions ==============================================
# return 1 if global command line program installed, else 0
# example
# echo "node: $(program_is_installed node)"
function program_is_installed {
# set to 1 initially
local return_=1