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 / conditions.js
Created September 28, 2011 18:42
JavaScript Conditions
var name = 'Ahmed El.Hussaini';
if(name == 'Ahmed El.Hussaini') {
console.log('Hello Mr.Bugz :)');
}
@sandboxws
sandboxws / conditions.coffee
Created September 28, 2011 18:46
CoffeeScript conditions
name = 'Ahmed El.Hussaini'
if name == 'Ahmed El.Hussaini'
console.log 'Hello Mr.Bugz'
@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]);
}
@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 / 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 / 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: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 / 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
<?php foreach($posts as $post) { ?>
<h1>
<a href="<?php echo $post->permaUrl ?>">
<?php echo $post->title ?>
</a>
</h1>
<?php } ?>
@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>
<% } %>