Skip to content

Instantly share code, notes, and snippets.

Change the css property background-position.
#logo-link
{
width:191px;
height:151px;
text-decoration:none;
display:block;
background-image:url(dw-logo-sprite.jpg);
background-position:191px 0;
#!/usr/bin/env ruby
#
# Generate css for the pro glyphicons.
# Run this script in the glyphicons_pro/glyphicons/png folder
# from the purchased zip file.
#
# see http://glyphicons.com/ for purchase/license information.
#
render = (ARGV.include? "--html") ? :html : :css
@emayk
emayk / extjs
Created October 11, 2013 06:10
exjs-centre-region-west-extjs
,init: function() {
var me = this;
me.control({
'viewport button[action=list-users]': {
click: me.showListUsers
}
...
});
@emayk
emayk / extjs
Created October 10, 2013 19:02
create-tab-new-tab-exjs
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="extjs/resources/css/ext-all.css">
<title>BadMonkey.com - Demo App</title>
<script type="text/javascript" src="extjs/ext-all-debug-w-comments.js"></script>
<script type="text/javascript">
Ext.onReady(function() {
@emayk
emayk / extjs-model-assoc-hasone
Created October 7, 2013 04:40
Rules for HasOne and BelongsTo Associations in ExtJS
// Rules for HasOne and BelongsTo Associations in ExtJS
// source :http://extjs-tutorials.blogspot.ca/2012/05/extjs-belongsto-association-rules.html
// Put the proxy in the model, unless you have a very good reason not to [1]
// Always use fully qualified model name
// Always set the getterName
// Always set the setterName
// Always set the associationKey, if the foreign object is returned in the same response as this object
// Always set the foreignKey, if you want to load the foreign object at will
// Consider changing the instanceName to something shorter
// The getter behaves differently depending on whether the foreign object is loaded or not. If it's loaded, the foreign object is returned. Otherwise, you need to pass in a callback to get it.
@emayk
emayk / create form at runtime
Created October 1, 2013 04:48
extjs, create form dynamic generate
/**
*
* Source From SO
* http://stackoverflow.com/questions/13095695/extjs-4-0-mvc-add-components-to-a-form-based-on-store
*
* Create Form Dynamics
**/
var myitems = Ext.create('Ext.data.Store', {
{
"scope": "source.js -string -comment -constant",
"completions": [
{ "trigger": "customtrigger.allowBlank\tBoolean", "contents": "allowBlank: $1${2:,}" },
{ "trigger": "customtrigger.allowOnlyWhitespace\tBoolean", "contents": "allowOnlyWhitespace: $1${2:,}" },
{ "trigger": "customtrigger.blankText\tString", "contents": "blankText: '$1'${2:,}" },
{ "trigger": "customtrigger.checkChangeBuffer\tNumber", "contents": "checkChangeBuffer: $1${2:,}" },
{ "trigger": "customtrigger.checkChangeEvents\tString[]", "contents": "checkChangeEvents: ['$1']${2:,}" },
{ "trigger": "customtrigger.dirtyCls\tString", "contents": "dirtyCls: '$1'${2:,}" },
// includes bindings for fetching/fetched
var PaginatedCollection = Backbone.Collection.extend({
initialize: function() {
_.bindAll(this, 'parse', 'url', 'pageInfo', 'nextPage', 'previousPage');
typeof(options) != 'undefined' || (options = {});
this.page = 1;
typeof(this.perPage) != 'undefined' || (this.perPage = 10);
},
fetch: function(options) {
// knockout-jquery-ui-widget.js
// Copyright (c) 2011, Planapple, Inc.
// License: MIT (http://www.opensource.org/licenses/mit-license.php)
//
// Knockout binding for jQuery UI widgets
//
// Examples:
// <input type="submit" value="OK" data-bind='jqueryui: "button"' />
//
// Attaches a jQuery UI button widget to this button, with default options.
ko.bindingHandlers.fileUpload = {
update: function(element, valueAccessor, allBindingsAccessor){
var value = ko.utils.unwrapObservable(valueAccessor())
if(element.files.length && value){
var file = element.files[0];
var url = allBindingsAccessor().url
xhr = new XMLHttpRequest();
xhr.open("post", url, true);