Skip to content

Instantly share code, notes, and snippets.

@Ajeey
Ajeey / todos.json
Created March 30, 2017 05:01
todos
[
{
id: 1,
title: "Get Milk",
completed: false
},
{
id: 2,
title: "Have breakfast",
completed: false
@Ajeey
Ajeey / Ember View
Created October 15, 2014 11:51
Ember View
Ember.View.reopen({
didInsertElement : function(){
this._super();
Ember.run.scheduleOnce('afterRender', this, this.afterRenderEvent);
},
afterRenderEvent : function(){
// implement this hook in your own subclasses and run your jQuery logic there
}
});
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
* {margin:0;}
body {background:#000000;}
</style>
</head>
/* lazyload.js (c) Lorenzo Giuliani
* MIT License (http://www.opensource.org/licenses/mit-license.html)
*
* expects a list of:
* `<img src="blank.gif" data-src="my_image.png" width="600" height="400" class="lazy">`
*/
!function(window){
var $q = function(q, res){
if (document.querySelectorAll) {
@Ajeey
Ajeey / gist:9738181
Created March 24, 2014 10:55
Regex!
Simple regex
Regex quick reference
[abc] A single character: a, b or c
[^abc] Any single character but a, b, or c
[a-z] Any single character in the range a-z
[a-zA-Z] Any single character in the range a-z or A-Z
^ Start of line
$ End of line
\A Start of string
#!/usr/bin/env ruby
require 'pygmentize' # gem install pygmentize
require 'selenium-webdriver' # gem install selenium-webdriver
exit unless code_path = ARGV.shift
file_path = File.absolute_path 'code.html'
image_path = File.absolute_path 'code_image.png'
code = Pygmentize.process File.read(code_path), :ruby
html = <<-EOT
@Ajeey
Ajeey / gist:8195894
Created December 31, 2013 12:16
Grunt gist
/*
TO DO
1) Reduce CSS duplication
- Ideally just a single build - global.scss turns into /build/global.css
- Can Autoprefixer output minified?
- If it can, is it as good as cssmin?
- Could Sass be used again to minify instead?
- If it can, is it as good as cssmin?