Skip to content

Instantly share code, notes, and snippets.

View chcepe's full-sized avatar
🏠
Working from home

Christian Cepe chcepe

🏠
Working from home
View GitHub Profile
@sarthology
sarthology / regexCheatsheet.js
Created January 10, 2019 07:54
A regex cheatsheet 👩🏻‍💻 (by Catherine)
let regex;
/* matching a specific string */
regex = /hello/; // looks for the string between the forward slashes (case-sensitive)... matches "hello", "hello123", "123hello123", "123hello"; doesn't match for "hell0", "Hello"
regex = /hello/i; // looks for the string between the forward slashes (case-insensitive)... matches "hello", "HelLo", "123HelLO"
regex = /hello/g; // looks for multiple occurrences of string between the forward slashes...
/* wildcards */
regex = /h.llo/; // the "." matches any one character other than a new line character... matches "hello", "hallo" but not "h\nllo"
regex = /h.*llo/; // the "*" matches any character(s) zero or more times... matches "hello", "heeeeeello", "hllo", "hwarwareallo"
@JamieMason
JamieMason / group-objects-by-property.md
Created September 14, 2018 07:38
Group Array of JavaScript Objects by Key or Property Value

Group Array of JavaScript Objects by Key or Property Value

Implementation

const groupBy = key => array =>
  array.reduce((objectsByKeyValue, obj) => {
    const value = obj[key];
    objectsByKeyValue[value] = (objectsByKeyValue[value] || []).concat(obj);
    return objectsByKeyValue;
@antoniopresto
antoniopresto / Form.js
Last active November 30, 2019 14:04
Antd Masked Input
import { Form } from 'antd'
import { FormInput } from './antd-masked-input'
export default () => (
<Form>
<FormInput
form={this.props.form} // antd form
mask={'111.111.111-11'}
placeholder=""
label={''}
@DataTurks
DataTurks / dataturks_to_PascalVOC.py
Last active April 26, 2020 08:54
Covert Dataturks Image bounding box JSON to Pascal VOC format.
import argparse
import sys
import os
import json
import logging
import requests
from PIL import Image
################### INSTALLATION NOTE #######################
##############################################################
@zthxxx
zthxxx / Activate Office 2019 for macOS VoL.md
Last active July 27, 2024 09:08
crack activate Office on mac with license file
@Prasad9
Prasad9 / annotation.xml
Created November 6, 2017 13:54
A sample XML annotation file based on Pascal VOC format.
<annotation>
<folder>GeneratedData_Train</folder>
<filename>000001.png</filename>
<path>/my/path/GeneratedData_Train/000001.png</path>
<source>
<database>Unknown</database>
</source>
<size>
<width>224</width>
<height>224</height>
var builder = require('botbuilder');
var restify = require('restify');
//Server setup
var server = restify.createServer();
server.listen(process.env.port || process.env.PORT || 3978, function() {
console.log('%s listening to %s', server.name, server.url);
});
@branneman
branneman / create-zip.js
Last active July 30, 2021 20:59
Node.js script to create a zip file from a list of files and directories
const stat = require('fs').statSync;
const AdmZip = require('adm-zip');
/**
* Example usage
*/
newArchive(`test-${+new Date}.zip`, [
'index.js',
'package.json',
'node_modules'
@davej
davej / fetch-timeout.js
Last active July 1, 2022 23:35
Add a pseudo timeout/deadline to a request using the ES6 fetch api
Promise.race([
fetch('/foo'),
new Promise((_, reject) =>
setTimeout(() => reject(new Error('Timeout')), 7000)
)
]);
@markerikson
markerikson / tableRenderingExample.js
Last active June 25, 2024 22:31
React expandable table rows example
class ParentComponent extends Component {
constructor() {
super();
this.state = {
data : [
{id : 1, date : "2014-04-18", total : 121.0, status : "Shipped", name : "A", points: 5, percent : 50},
{id : 2, date : "2014-04-21", total : 121.0, status : "Not Shipped", name : "B", points: 10, percent: 60},
{id : 3, date : "2014-08-09", total : 121.0, status : "Not Shipped", name : "C", points: 15, percent: 70},
{id : 4, date : "2014-04-24", total : 121.0, status : "Shipped", name : "D", points: 20, percent : 80},