Skip to content

Instantly share code, notes, and snippets.

@jamesmenera
jamesmenera / CLOSED HTML TAGS
Created January 10, 2012 00:13
JADE PAUL IRISH HTML TRICK
JADE:
!!!5
//if ! IE
html
//if IE 6
html.ie6
//if IE 7
html.ie7
@jamesmenera
jamesmenera / passfieldfix.js
Created November 15, 2012 18:24
Fix placeholder behaviour in password fields in IE
$(function(){
var ua = navigator.userAgent,
is_msie = ua.match(/msie/gi);
if (is_msie){
Placeholder.init({
normal : "#000000",
placeholder : "#777777",
wait: true
/********************************
* UPDATE: I have crated a plugin to do this: https://github.com/jboesch/jQuery-fullCalendar-iPad-drag-drop/
*********************************/
/*These are the brief steps that it takes to get fullCalendar (http://arshaw.com/fullcalendar/) up and running with drag/drop support on the iPad. This assumes you already have fullCalendar setup.*/
//1. Include a copy of jQuery touch punch in your project, you can find it here: https://github.com/furf/jquery-ui-touch-punch
//2. Go into jquery-touch-punch.js and right after this line (around line 57 - mouseProto._mouseDown = function (event) {) add this: this._mouseDownEvent = event;
//3. Add this function somewhere in your global.js file or wherever you want:
// taken from http://www.dreamincode.net/code/snippet154.htm
//
// Find the weaknesses, and clean up the code.
// Find at least 3 things you can make better!
//
// Test numbers (return true):
// 4111111111111111
// 378282246310005
// 5555555555554444
// Exercise 2 - Closures
// Wrap the following code in a closure and export only the "countdown" function.
// Code
var index = (function log(){
console.log(index);
}
function iterate(){
log();
@jamesmenera
jamesmenera / gist:5111655
Last active December 14, 2015 15:58
Homework 1
// Exercise 1 - OO || !OO
// Define a data structure for cars (make and color), and a function
// that logs a string like "I'm a red Mercedes" to the console.
// Make two versions: a functional version, and a object-oriented version.
//Two solutions, one with a constructor only, and one using prototypes
// Example call for functional version:
var logCar = function(car) {
console.log('I\'m a ' + car.color + ' ' + car.make);
// Part 1.
// Implement a function prototype extension that caches function results for
// the same input arguments of a function with one parameter.
//
// For example:
// Make sin(1) have the result of Math.sin(1), but use a cached value
// for future calls.
//
// Part 2.
// Use this new function to refactor the code example.
// 1. Write a class to support the following code:
Person = function(name){
this.name = name;
console.log('name');
}
var thomas = new Person('Thomas');
var amy = new Person('Amy');
import DS from 'ember-data';
import Ember from 'ember';
let attr = DS.attr,
belongsTo = DS.belongsTo,
hasMany = DS.hasMany;
export default DS.Model.extend({
firstName: attr(),
lastName: attr(),
import Ember from 'ember';
export default Ember.Controller.extend({
date: null
});