Skip to content

Instantly share code, notes, and snippets.

View ahmednuaman's full-sized avatar
💭
I'm hiring! https://firemind.io/careers

Ahmed Nuaman ahmednuaman

💭
I'm hiring! https://firemind.io/careers
View GitHub Profile
@ahmednuaman
ahmednuaman / default.js
Created January 6, 2015 16:00
Getting BrowserSync and gulp-watch to play nicely
var browserSync = require('browser-sync'),
common = require('./__common__'),
gulp = require('gulp'),
watch = require('gulp-watch');
gulp.task('default', [
'less'
], function () {
browserSync({
server: {
@ahmednuaman
ahmednuaman / grunt-githash.js
Created December 12, 2014 15:22
Grunt githash grabber
// use like <%= commitsha1 %>
grunt.registerTask('githash', function () {
var done = this.async(),
config;
config = {
cmd: 'git',
args: ['rev-parse', '--verify', 'HEAD']
};
@ahmednuaman
ahmednuaman / parse.py
Created October 3, 2014 14:50
A simple example of how to parse a page with python
import urllib2
from bs4 import BeautifulSoup
page = urllib2.urlopen('http://www.bbc.co.uk/sport/football/tables')
soup = BeautifulSoup(page)
rows = soup.find_all('tr')
for row in rows:
team = row.find('td', class_='team-name')
@ahmednuaman
ahmednuaman / foo-directive-partial.html
Created September 22, 2014 08:56
The difference between @, =, and & in AngularJS directives
<div class="foo">
<ul>
<li data-ng-repeat="item in items">{{item}}</li>
</ul>
</div>
#
# Sets Prezto options.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
#
# General
#
@ahmednuaman
ahmednuaman / scoping.js
Created July 21, 2014 19:10
That's a naughty JS dev
describe('scoping', function () {
it('should correctly deal with scoping `this` back to the callee', function () {
var mod = new Module(),
request;
request = function (callback) {
return callback();
};
function Module () {
@ahmednuaman
ahmednuaman / gulpfile.js
Created July 9, 2014 18:28
GULP Y U NO RUN IN SERIES
var compass = require('gulp-compass'),
concat = require('gulp-concat'),
cssmin = require('gulp-cssmin'),
gulp = require('gulp'),
imagemin = require('gulp-imagemin'),
jscs = require('gulp-jscs'),
jshint = require('gulp-jshint'),
livereload = require('gulp-livereload'),
rename = require('gulp-rename'),
replace = require('gulp-replace'),
@ahmednuaman
ahmednuaman / remove-v-from-git-tags.sh
Created June 25, 2014 11:54
Remove the v from git tags
for tag in $(git tag)
do
git tag "${tag/v/}" $tag
done
for tag in $(git tag)
do
if [[ $tag = *v* ]]
then
git tag -d $tag
@ahmednuaman
ahmednuaman / @-watch-directive.coffee
Created May 31, 2014 19:07
Angular directive test @ scope with watch
define [
'config'
'directive/radian-directive'
], (cfg, RD) ->
RD 'yolo', [
'$rootScope'
], ($rootScope) ->
restrict: 'A'
replace: true
scope:
@ahmednuaman
ahmednuaman / @-directive.coffee
Last active August 29, 2015 14:02
Angular directive test @ scope
define [
'config'
'directive/radian-directive'
], (cfg, RD) ->
RD 'yolo', [
'$rootScope'
], ($rootScope) ->
restrict: 'A'
replace: true
scope: