Skip to content

Instantly share code, notes, and snippets.

Avatar

Rajat Mittal lifeinafolder

View GitHub Profile
@lifeinafolder
lifeinafolder / components.instamojo-payment.js
Created April 29, 2017 17:15
Instamojo Emberjs Component
View components.instamojo-payment.js
import Ember from 'ember';
export default Ember.Component.extend({
didInsertElement() {
this._super(...arguments);
Ember.$.getScript('https://d2xwmjc4uy2hr5.cloudfront.net/im-embed/im-embed.min.js');
},
didRender() {
console.log(Ember.$('.im-checkout a'));
}
View gist:addc9e0663f7db74e2a42da5a3ae7c93
const pages = [
{
image: "URL", // a 1x1 grid image
cells: [
{
x: 0,
y: 0,
width: 100%
}
]
@lifeinafolder
lifeinafolder / radio-button-group.js
Last active December 23, 2015 20:09
Ember wrapper for radio button group
View radio-button-group.js
UiControls = window.UiControls || Ember.Namespace.create();
/**
* An Ember RadioButton Group Control
*
* @example
* {{#view UiControls.RadioButtonGroup group="segment-option" valueBinding="sendingPreference"}}
* {{view UiControls.RadioButton title="Title 1" value="1"}}
* {{view UiControls.RadioButton title="Title 2" value="2"}}
* {{/view}}
@lifeinafolder
lifeinafolder / chosen-multi-select.js
Created September 24, 2013 16:19
An Ember wrapper for chosen multi-select
View chosen-multi-select.js
//= require chosen-jquery
UiControls = window.UiControls || Ember.Namespace.create();
/**
* Custom Multi-Select enabled with 'chosen'
* @class
* @memberOf UiControls
* @extends Ember.Select
*
@lifeinafolder
lifeinafolder / onoff-switch.js
Created September 24, 2013 16:17
An ember wrapper for the bootstrap-switch module.
View onoff-switch.js
//= require bootstrap-switch
UiControls = window.UiControls || Ember.Namespace.create();
/**
* Custom iPhone style ON-OFF switch control
*
* @class
* @memberOf UiControls
* @extends Ember.View
@lifeinafolder
lifeinafolder / input-max-length.js
Created September 17, 2013 05:35
Ember Input Fields with character limits
View input-max-length.js
UiControls = window.UiControls || Ember.Namespace.create();
/**
* A MaxLength UI Control
* It extends your regular INPUT[type='text'] & TEXTAREA fields
* to support a character count on them
*
* @class
* @memberOf UiControls
* @extends Ember.View
@lifeinafolder
lifeinafolder / Ember Redactor Wrapper
Created December 5, 2012 13:10
Ember-Redactor.js
View Ember Redactor Wrapper
RedactorView = Ember.View.extend({
templateName: 'redactor',
didInsertElement: function () {
require('editor/vendor/redactor/redactor');
// If 'css' is not injected yet, inject it.
if (!Utils.hasCss('css/redactor.css')) {
$('head').append('<link rel="stylesheet" href="css/redactor.css" type="text/css" />');
}
@lifeinafolder
lifeinafolder / minispade.txt
Created October 3, 2012 18:23
Minispade Options
View minispade.txt
# @option options [Boolean] :string If true, compiles the output as
# a String instead of a closure. This means that @sourceURL can be
# appended for good stack traces and debugging.
@lifeinafolder
lifeinafolder / output.txt
Created June 16, 2012 10:41
Javelin Build Script Output
View output.txt
+ set -e
++ dirname scripts/build.sh
+ ROOT=scripts/../
+ cd scripts/../externals/libfbjs
+ make
g++ -fPIC -Wall -DNOT_FBMAKE=1 -ggdb -g -O0 -DDEBUG -c -o parser.yacc.o parser.yacc.cpp
g++ -fPIC -Wall -DNOT_FBMAKE=1 -ggdb -g -O0 -DDEBUG -c -o node.o node.cpp
/usr/include/c++/4.2.1/ext/ropeimpl.h: In static member function ‘static typename __gnu_cxx::rope<_CharT, _Alloc>::_RopeLeaf* __gnu_cxx::rope<_CharT, _Alloc>::_S_leaf_concat_char_iter(__gnu_cxx::_Rope_RopeLeaf<_CharT, _Alloc>*, const _CharT*, size_t) [with _CharT = char, _Alloc = std::allocator<char>]’:
/usr/include/c++/4.2.1/ext/ropeimpl.h:675: instantiated from ‘static typename __gnu_cxx::rope<_CharT, _Alloc>::_RopeRep* __gnu_cxx::rope<_CharT, _Alloc>::_S_concat(__gnu_cxx::_Rope_RopeRep<_CharT, _Alloc>*, __gnu_cxx::_Rope_RopeRep<_CharT, _Alloc>*) [with _CharT = char, _Alloc = std::allocator<char>]’
/usr/include/c++/4.2.1/ext/rope:2763: instantiated from ‘__gnu_cxx::rope<_CharT, _Alloc> __gnu_cxx::operator+(const __gnu_cxx::rope<_CharT, _Alloc>&,
View promises-mixing.js
var fn = function() {
var dfd = new Deferred();
var promises = [];
promises.push(async1()); // an async operation
promises.push(async2()); // an async operation
promises.push(sync1()); // a sync operation
promises.push(async3()); // an async operation
// You want to perform some computation after above 4 tasks are done.