Skip to content

Instantly share code, notes, and snippets.

View deitch's full-sized avatar

Avi Deitcher deitch

View GitHub Profile
@deitch
deitch / testjs
Created January 1, 2012 10:09
Test js
/*
* jsTreeGrid 0.98
* http://jsorm.com/
*
* This plugin handles adding a grid to a tree to display additional data
*
* Dual licensed under the MIT and GPL licenses (same as jQuery):
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
@deitch
deitch / backbone-with-wizard.js
Created September 3, 2013 05:14
Backbone with jquery.wizard
NewItemView = Backbone.View.extend({
el: "div#newitm",
events: {
"click input#clicktocreate-button":"createItem"
},
initialize: function() {
var that = this;
this.subitemView = new SubItemView({el:"div#newitem div.item-list"});
this.$el.wizard({
beforeSelect: function(event,state) {
factory('Resource',['$resource',function ($resource) {
return function(url,params,methods){
var defaults = {
update: { method: 'put', isArray: false },
patch: { method: 'patch', isArray: false },
create: { method: 'post' }
}, resource = $resource(url,params,angular.extend(defaults,methods)), urlParams = {};
// need to change $save *after* creating $resource
resource.prototype.$save = function() {
// directive
.directive('resetSearchModel',function () {
return {
restrict: 'A',
require: ['^ngModel','uiSelect'],
link: function (scope, element, attrs, ctrls) {
if (attrs.resetSearchModel === "true" || attrs.resetSearchModel === true) {
scope.$watch(attrs.ngModel,function (newval,oldval,scope) {
scope.$select.selected = undefined;
});
@deitch
deitch / setCookie
Created April 1, 2015 09:31
setCookie()
var setCookie = function (key, value, options) {
var result = null, decode, days, t, i, pair, pairs, opts = options;
// key and value given, set cookie...
if (arguments.length > 1 && (value === null || typeof(value) !== "object")) {
opts = opts || {};
if (value === null) {
opts.expires = -1;
}
@deitch
deitch / jstreegrid-patch.js
Created September 3, 2015 05:37
jstreegrid patch test
/*
* http://github.com/deitch/jstree-grid
*
* This plugin handles adding a grid to a tree to display additional data
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/mit-license.php
*
* Works only with jstree version >= 3.0.0
*
{
"brand": "lx",
"image_uuid": "36c1c12a-1b7e-11e5-8f38-eba28d6b3ec6",
"alias": "vPerf2LMPA_66",
"hostname": "vPerf2LMPA",
"quota": 100,
"kernel_version": "2.6.32",
"nics": [
{
"nic_tag": "external",
{
"brand": "lx",
"image_uuid": "36c1c12a-1b7e-11e5-8f38-eba28d6b3ec6",
"alias": "vPerf2LMPA_66",
"hostname": "vPerf2LMPA",
"quota": 100,
"kernel_version": "2.6.32",
"resolvers": ["172.16.5.10","172.16.5.11"],
"nics": [
{
FROM ubuntu
RUN echo hello > /tmp/foo
#!/bin/sh
ask_for_password () {
cryptkey="Unlocking the disk $cryptsource ($crypttarget)\nEnter passphrase: "
if [ -x /bin/plymouth ] && plymouth --ping; then
cryptkeyscript="plymouth ask-for-password --prompt"
cryptkey=$(printf "$cryptkey")
else
cryptkeyscript="/lib/cryptsetup/askpass"
fi