Skip to content

Instantly share code, notes, and snippets.

View sandboxws's full-sized avatar
🏠
Debug → Analyze → Refactor → Performance Gains → Repeat

Ahmed Elhossaini sandboxws

🏠
Debug → Analyze → Refactor → Performance Gains → Repeat
View GitHub Profile
@sandboxws
sandboxws / index.html
Created August 15, 2012 19:25
A web page created at CodePen.io.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- IF PEN IS PRIVATE -->
<!-- <meta name="robots" content="noindex"> -->
<!-- END -->
@sandboxws
sandboxws / tm_to_subl.rb
Created March 7, 2012 10:07
Convert TextMate snippets to Sublime Text 2 snippets
require 'nokogiri'
require 'fileutils'
require 'active_support/inflector'
def friendly_filename(filename)
filename.gsub(/[^\w\s_-]+/, '')
.gsub(/(^|\b\s)\s+($|\s?\b)/, '\\1\\2')
.gsub(/\s/, '_')
end
@sandboxws
sandboxws / gist:1799476
Created February 11, 2012 13:39
HTML/JSP
<% for(Post post : PostDao.getAllPosts()) { %>
<h1>
<a href="showPost.jsp?id=<%= post.getId() %>"><%= post.getTitle() %></a>
</h1>
<% } %>
<?php foreach($posts as $post) { ?>
<h1>
<a href="<?php echo $post->permaUrl ?>">
<?php echo $post->title ?>
</a>
</h1>
<?php } ?>
@sandboxws
sandboxws / simple_classes.coffee
Created September 28, 2011 23:41
CoffeeScript simple classes
class eSpacian
constructor: (@name) ->
sayHello: ->
console.log @name + ' says Hello'
class Developer extends eSpacian
constructor: (name, @favLanguage) ->
super name
@sandboxws
sandboxws / gist:1249140
Created September 28, 2011 20:18
JavaScript function snippet
var getAlbumName = function(trackName) {
var albumName = null;
var albums = {
theDarkSideOfTheMoon: {
title: 'The Dark Side of the Moon',
tracks: [
{title: 'Speak To Me'},
{title: 'Breathe'},
{title: 'On The Run'},
{title: 'Time'},
@sandboxws
sandboxws / gist:1249008
Created September 28, 2011 19:39
CoffeeScript for loop an object
person =
name: 'Ahmed El.Hussaini',
age: 31,
email: 'ahmed.elhussaini@espace.com.eg',
blog: 'http://sandboxws.com',
splinterScore: 224,
splinterProfileUrl: 'http://splinterme.com/sandboxws'
for key, value of person
console.log key + ': ' + value
@sandboxws
sandboxws / gist:1248982
Created September 28, 2011 19:32
JavaScript for loop an object
var person = {
name: 'Ahmed El.Hussaini',
age: 31,
email: 'ahmed.elhussaini@espace.com.eg',
blog: 'http://sandboxws.com',
splinterScore: 224,
splinterProfileUrl: 'http://splinterme.com/sandboxws'
};
for(property in person) {
@sandboxws
sandboxws / for_loop.coffee
Created September 28, 2011 19:15
CoffeeScript for loop
languages = ['Ruby', 'CoffeeScript', 'JavaScript']
for language in languages
console.log language
@sandboxws
sandboxws / foo_loop.js
Created September 28, 2011 18:50
JavaScript for loop
var languages = ['Ruby', 'CoffeeScript', 'JavaScript'];
for(var i=0; i < languages.length; i++) {
console.log(languages[i]);
}