Skip to content

Instantly share code, notes, and snippets.

View nombrekeff's full-sized avatar
🤘
Working on Cardboard

Manolo Edge nombrekeff

🤘
Working on Cardboard
View GitHub Profile
@nombrekeff
nombrekeff / FlutterLocalization.dart
Created March 27, 2020 12:24
A couple of classes for managing Translations in flutter, from json, with interpolation.
import 'dart:convert';
import 'package:flutter/cupertino.dart';
import 'package:flutter/services.dart';
class AppLocalizations {
final Locale locale;
AppLocalizations(this.locale);
// Helper method to keep the code in the widgets concise
@nombrekeff
nombrekeff / advanced-ts-2.md
Last active February 11, 2020 11:29
Gist for "Advanced TypeScript Exercises - Question 2"

PD: I don't know if it's the correct answer, but it's what I would of done :)

I think it fails because we always expect the output type to be equal to the generic type, although we always return a User.

Typescript tells us that if we pass in a generic type, for example:

createCustomer<{  id: number, kind: string, other: number }>({ 
  id: 1, 
  kind: 'customer' 
});
@nombrekeff
nombrekeff / docker-stopall.sh
Last active February 11, 2020 09:28
[docker stop all] stop or kill all containers #docker
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
@nombrekeff
nombrekeff / shebang, linux, bash,
Created February 10, 2020 14:49
[bash sebang] #!/bin/bash
#!/bin/bash
@nombrekeff
nombrekeff / ghowda.meta
Last active February 8, 2020 22:14
This is a test ghowda blog (javascript, demo)
{
"labels": ["test", "javascript"],
"title": "Blog 1"
}
@nombrekeff
nombrekeff / git-reverse-commit.sh
Created January 23, 2020 09:47
[Git reverse last commit]
git checkout Branch1
git reset --hard HEAD~1
@nombrekeff
nombrekeff / ng-for-template.ts
Created January 22, 2020 10:46
[Ng Template ngFor] Angular ng-template with ngFor #angular
<ng-template ngFor let-act [ngForOf]="account.activities">
</ng-template>
@nombrekeff
nombrekeff / flatten-object.js
Last active December 8, 2019 10:53
Get all path from an object
/**
* returns an array containing all paths to a value other than an object
* @param {object} obj
*/
function flattenObject(obj) {
if (typeof obj !== 'object') {
return [];
}

Undo commit:

git reset --soft HEAD~1
@nombrekeff
nombrekeff / test.js
Last active June 29, 2019 05:48
selenium-webdriver .setPreference is not a function
const { Builder } = require('selenium-webdriver'); // Currently using ^3.6.0
const firefox = require('selenium-webdriver/firefox'); // Currently using ^3.6.0
// Create a builder for browser 'firefox'
let builder = new Builder().forBrowser('firefox');
// I then create firefox options
let options = new firefox.Options();
// setPreference is present in the docs as well as the type file for this version