Skip to content

Instantly share code, notes, and snippets.

View lomedil's full-sized avatar

Jairo Sansegundo lomedil

  • Víntegris
  • Cantabria
  • 17:57 (UTC +02:00)
View GitHub Profile
@lomedil
lomedil / README.md
Last active January 27, 2020 10:16
Notes about typescript definition files for javascript

Typescript definition files for javascript

Declaring functions/callbacks with generics

I have observed some issues when declaring a function with generics related to some parameters.

Just figure out a type defined like this:

interfaces Response { type: string;

@lomedil
lomedil / gist:41b739a74b481c4b0a47fca09f42bea3
Created April 10, 2018 07:06
Output color of echo in Linux
# Reset
Color_Off='\033[0m' # Text Reset
# Regular Colors
Black='\033[0;30m' # Black
Red='\033[0;31m' # Red
Green='\033[0;32m' # Green
Yellow='\033[0;33m' # Yellow
Blue='\033[0;34m' # Blue
Purple='\033[0;35m' # Purple
@lomedil
lomedil / gist:5f7bc779d53c5160b4484042d81738f2
Created December 11, 2016 10:23
Download RVM and install
echo "Downloading RVM..."
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
curl -sSL https://get.rvm.io | bash -s stable
@lomedil
lomedil / viewports.js
Last active May 27, 2016 17:39
JSON array with common viewport sizes
[
{"name" : "QVGA", "width": 320, "height" : 240 },
{"name" : "VGA", "width": 640, "height" : 480 },
{"name" : "SVGA", "width": 800, "height" : 600 },
{"name" : "WVGA", "width": 800, "height" : 480 },
{"name" : "WVGA", "width": 854, "height" : 480 },
{"name" : "WSVGA", "width": 1024, "height" : 600 },
{"name" : "XGA", "width": 1024, "height" : 768 },
{"name" : "SXGA", "width": 1280, "height" : 1024 },
{"name" : "WXGA", "width": 1280, "height" : 768 },
@lomedil
lomedil / Usage.cs
Last active August 29, 2015 14:08
How to use embedded fonts in Winforms
public class partial FooForm : System.Windows.Forms.Form
{
public FooForm()
{
_privateFonts = Utils.GetEmbeddedFont(Resources.FontAwesome);
}
private PrivateFontCollection _privateFonts;
}
@lomedil
lomedil / dirFiles.pri
Created September 16, 2014 16:07
Get files from folder
## Get files from path
defineReplace(dirFiles){
dir = $$1/*
selected_entries =
all_entries = $$files($$dir)
# For every entry: select it if it isn't a folder
for(entry, all_entries):!exists($$entry/*):selected_entries += $$entry
return($$selected_entries)
}
// define plain JS object list
property var model: [
{ title: qsTr("Airplane"), descr: qsTr("Some descr 1") },
{ title: qsTr("Car"), descr: qsTr("Some descr 2") },
{ title: qsTr("Credit Card"), descr: qsTr("Some descr 3") }
]
ListView {
model: root.model
delegate: Rectangle {
@lomedil
lomedil / gist:9e0d9262fdb3765128db
Created July 19, 2014 15:10
Simple string list inherited from QAbstractListModel
// SimpleStringList.h
#ifndef _SIMPLEMODEL_H_
#define _SIMPLEMODEL_H_
#include <QtCore>
class SimpleStringModel : public QAbstractListModel
{
@lomedil
lomedil / gist:9915109
Created April 1, 2014 14:22
Grant file acceso to Everyone
private static void GrantAccess(string filepath)
{
// Get "Everyone" account name
var sid = new SecurityIdentifier(WellKnownSidType.WorldSid, null);
var acct = sid.Translate(typeof(NTAccount)) as NTAccount;
var everyoneAccountName = acct.ToString(); // SP=Todos, EN=Everyone, FR...
try
{
var infoFile = new FileInfo(filepath);