Skip to content

Instantly share code, notes, and snippets.

View vinilios's full-sized avatar

Kostas Papadimitriou vinilios

  • GRNet
  • Athens, Greece
View GitHub Profile
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function withContextProps<P, C extends React.Context<any>>(
component: React.FC<P>,
context: C,
hook?: (a: React.ContextType<C>, b: P) => Partial<P>
): React.FC<P> {
type CP = React.ContextType<C>;
type UP = CP & P;
const commonHook = (ctx: CP | null, p: P): UP => {
return ctx ? { ...ctx, ...p } : (p as UP);
@vinilios
vinilios / controllers.application.js
Last active October 12, 2016 13:16
ember sorting
import Ember from 'ember';
let MODEL = Ember.A([
Ember.Object.create({value: 1}),
Ember.Object.create({value: 2}),
Ember.Object.create({value: 3}),
Ember.Object.create({value: 4})
]);
export default Ember.Controller.extend({
@vinilios
vinilios / controllers.application.js
Created October 3, 2016 16:20
strange-cp-updates
import Ember from 'ember';
const {
set, get, on, computed
} = Ember;
const MyClass = Ember.Object.extend({
fullname: computed('profile', 'profile.name', 'profile.surname', function() {
console.log("resolve fullname");
@vinilios
vinilios / components.my-but.js
Last active August 5, 2016 07:35
test-focus-invalidation
import Ember from 'ember';
export default Ember.Component.extend({
init: function() {
this._super();
console.log("lala");
},
tagName: 'button',
classNameBindings: ['focused:focus'],
click: function(event) {
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
@vinilios
vinilios / thepresscliker.user.js
Created February 10, 2015 23:30
thepressproject.gr userscript
// @name thepressproject.gr clicker
// @namespace http://thepressproject.gr/#clickerscript
// @version 0.0.1
// @author Kostas Papadimitriou <[email protected]>
// @description Fix thepressproject.gr links and context menu annoyances.
// @domain thepressproject.gr
// @domain www.thepressproject.gr
// @match http://www.thepressproject.gr/*
// @match https://www.thepressproject.gr/*
// @match https://thepressproject.gr/*
@vinilios
vinilios / gist:1884440
Created February 22, 2012 11:42
pithos-sh create fix
diff --git snf-pithos-tools/pithos/tools/sh.py snf-pithos-tools/pithos/tools/sh.py
index f0ae12c..8dac56a 100755
--- snf-pithos-tools/pithos/tools/sh.py
+++ snf-pithos-tools/pithos/tools/sh.py
@@ -225,12 +225,12 @@ class Meta(Command):
class CreateContainer(Command):
syntax = '<container> [key=val] [...]'
description = 'create a container'
- policy={}
+ policy={'versioning':'', 'quota':''}
#Shell script for KDE launching CopperCore
DIRNAME=`dirname $0`
DIRNAME=`cd $DIRNAME; pwd`
PROGNAME=`basename $0`
# Add the CopperCore.properties to the class path
JBOSS_CLASSPATH="$DIRNAME:"
export JBOSS_CLASSPATH
@vinilios
vinilios / default mysql storage engine for the current session
Created March 8, 2010 00:46
default mysql storage engine for the current session
SET storage_engine=MYISAM;
@vinilios
vinilios / uwsgi update on code change
Created January 19, 2010 00:32
uwsgi update on code change
#!/usr/bin/python
import os, sys, subprocess
from pyinotify import *
# the watch manager stores the watches and provide operations on watches
wm = WatchManager()
# watched events
mask = IN_DELETE | IN_CREATE | IN_MODIFY