Skip to content

Instantly share code, notes, and snippets.

View hervehobbes's full-sized avatar

Hervé hervehobbes

View GitHub Profile

Home portal app

It's a home portal app design concept with fix 800x480 resolution. Designed to Raspberry Pi2. Animation with awesome GSAP.

A Pen by Hervé on CodePen.

License.

@hervehobbes
hervehobbes / BytesPlayground.swift
Created February 13, 2019 15:14 — forked from brennanMKE/BytesPlayground.swift
Copy bytes from Data with Swift
import Foundation
let size = MemoryLayout<Int16>.stride
let data = Data(bytes: [1, 0, 2, 0, 3, 0]) // little endian for 16-bit values
let int16s = data.withUnsafeBytes { (bytes: UnsafePointer<Int16>) in
Array(UnsafeBufferPointer(start: bytes, count: data.count / size))
}
let length = data.count * MemoryLayout<Int16>.stride
@hervehobbes
hervehobbes / Bytes.swift
Created February 13, 2019 15:13 — forked from brennanMKE/BytesOriginal.swift
Bytes formatted for binary or hex strings.
//: [Previous](@previous)
import Foundation
struct Bytes {
enum Size: Int {
case eight = 8
case sixteen = 16
case thirtyTwo = 32
case sixtyFour = 64
@hervehobbes
hervehobbes / phone.validator.ts
Created May 11, 2018 11:30 — forked from djabif/phone.validator.ts
Angular Phone + Country Validator
import { AbstractControl, ValidatorFn } from '@angular/forms';
import * as libphonenumber from 'google-libphonenumber';
export class PhoneValidator {
// Inspired on: https://github.com/yuyang041060120/ng2-validation/blob/master/src/equal-to/validator.ts
static validCountryPhone = (countryControl: AbstractControl): ValidatorFn => {
let subscribe = false;
return (phoneControl: AbstractControl): {[key: string]: boolean} => {
@hervehobbes
hervehobbes / password.validator.ts
Created May 11, 2018 11:30 — forked from djabif/password.validator.ts
Password Validator for ionic apps
import { FormControl, FormGroup } from '@angular/forms';
export class PasswordValidator {
static areEqual(formGroup: FormGroup) {
let val;
let valid = true;
for (let key in formGroup.controls) {
if (formGroup.controls.hasOwnProperty(key)) {
let control: FormControl = <FormControl>formGroup.controls[key];
@hervehobbes
hervehobbes / form.ts
Created May 11, 2018 11:29 — forked from djabif/form.ts
Ionic Password validator
import { PasswordValidator } from '../../validators/password.validator';
this.matching_passwords_group = new FormGroup({
password: new FormControl('', Validators.compose([
Validators.minLength(5),
Validators.required,
Validators.pattern('^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])[a-zA-Z0-9]+$') //this is for the letters (both uppercase and lowercase) and numbers validation
])),
confirm_password: new FormControl('', Validators.required)
}, (formGroup: FormGroup) => {
return PasswordValidator.areEqual(formGroup);
@hervehobbes
hervehobbes / logo.svg
Created May 7, 2018 11:42 — forked from christopherkade/logo.svg
Star Wars SVG logo
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hervehobbes
hervehobbes / keybindings.json
Created December 6, 2017 10:22
Paramétrage de mes raccourcis clavier dans vscode
// Placez vos combinaisons de touches dans ce fichier pour remplacer les valeurs par défaut
[
{ "key": "ctrl+1", "command": "workbench.action.focusActiveEditorGroup", "when": "terminalFocus" },
{ "key": "ctrl+2", "command": "workbench.action.terminal.focus", "when": "!terminalFocus" }
]
@hervehobbes
hervehobbes / settings.json
Last active December 11, 2017 15:38
Ma configuration de vscode
// Placez vos paramètres dans ce fichier pour remplacer les paramètres par défaut
{
"workbench.colorTheme": "Visual Studio Dark",
"editor.fontSize": 16,
"files.trimTrailingWhitespace": true,
"window.zoomLevel": 0,
"workbench.iconTheme": "material-icon-theme",
"workbench.editor.enablePreview": false,
"editor.minimap.enabled": false,
"terminal.external.windowsExec": "F:\\cmder\\cmder.exe",
@hervehobbes
hervehobbes / increment_build_number.js
Created November 25, 2017 08:07
Cordova hook for incrementing build numbers
#!/usr/bin/env node
// Save hook under `project-root/hooks/before_prepare/`
//
// Don't forget to install xml2js using npm
// `$ npm install xml2js`
var fs = require('fs');
var xml2js = require('xml2js');