Skip to content

Instantly share code, notes, and snippets.

View seyfer's full-sized avatar
💭
pet the duck until exploded

Oleg Abrazhaev seyfer

💭
pet the duck until exploded
View GitHub Profile
@ofer-papaya
ofer-papaya / fullstory.d.ts
Created February 18, 2019 11:57
Fullstory API typescript definitions
interface Fullstory {
identify(uid: string): void;
setUserVars(userVars: object): void;
getCurrentSessionURL(): string;
log(msg: string);
log(level: string, msg: string);
shutdown();
restart();
consent(consent: boolean);
}
@bradtraversy
bradtraversy / docker_wordpress.md
Last active April 23, 2024 20:57
Docker Compose FIle For Wordpress, MySQL & phpmyadmin

Wordpress & Docker

This file will setup Wordpress, MySQL & PHPMyAdmin with a single command. Add the code below to a file called "docker-compose.yaml" and run the command

$ docker-compose up -d

# To Tear Down
$ docker-compose down --volumes
@ibreathebsb
ibreathebsb / upload.js
Last active April 5, 2023 04:43
file upload from dataUrl with axios
// Note: only for modern browser
import axios from 'axios'
// helper function: generate a new file from base64 String
const dataURLtoFile = (dataurl, filename) => {
const arr = dataurl.split(',')
const mime = arr[0].match(/:(.*?);/)[1]
const bstr = atob(arr[1])
let n = bstr.length
const u8arr = new Uint8Array(n)
@leilee
leilee / cl-fmt.sh
Created December 13, 2017 07:52
clang-format files recursively
#!/bin/bash
# Variable that will hold the name of the clang-format command
FMT=""
# Some distros just call it clang-format. Others (e.g. Ubuntu) are insistent
# that the version number be part of the command. We prefer clang-format if
# that's present, otherwise we work backwards from highest version to lowest
# version.
for clangfmt in clang-format{,-{4,3}.{9,8,7,6,5,4,3,2,1,0}}; do
@jeffochoa
jeffochoa / Response.php
Last active April 20, 2024 12:35
Laravel HTTP status code
<?php
// This can be found in the Symfony\Component\HttpFoundation\Response class
const HTTP_CONTINUE = 100;
const HTTP_SWITCHING_PROTOCOLS = 101;
const HTTP_PROCESSING = 102; // RFC2518
const HTTP_OK = 200;
const HTTP_CREATED = 201;
const HTTP_ACCEPTED = 202;
@seyfer
seyfer / apn-server.php
Last active October 11, 2017 10:29 — forked from samvermette/apn-server.php
Quickly send an Apple Push Notification using PHP
<?php
$apnsHost = 'gateway.sandbox.push.apple.com';
$apnsCert = 'ck.pem';
$apnsPort = 2195;
$apnsPass = '<PASSWORD_GOES_HERE>';
$token = '<DEVICE_TOKEN_GOES_HERE>';
$payload['aps'] = array('alert' => 'Oh hai!', 'badge' => 1, 'sound' => 'default');
$output = json_encode($payload);
@sixlive
sixlive / 0.POST.md
Last active August 9, 2022 20:40
My Current PHP CS Fixer Workflow

This is the process and standard that I use for the vast majority of my Laravel code bases and projects.

For more information about php-cs-fixer visit the project repository: FriendsOfPHP/PHP-CS-FIXER.

Setup

Add the following .php_cs file to the root of your project.

.php_cs

@blogscot
blogscot / myPinkTruck.js
Last active November 19, 2021 03:53
Factory Pattern examples using ES6 syntax
class Car {
constructor(doors = 4, state = "brand new", color = "silver") {
this.doors = doors
this.state = state
this.color = color
}
}
class Truck {
@crcdng
crcdng / headless-pi.md
Last active February 1, 2021 11:06
How to set up your Raspberry Pi including WiFi without monitor and keyboard from a Mac.

Set up Your Raspberry Pi Headless in 10 Easy 🤔 Steps

Goal

You want to set up your Raspberry Pi without monitor and keyboard. This is sometimes called "headless". Don't worry, you'll keep your head if you follow these step-by-step instructions (however, see license and disclaimer below). We will install the Raspbian operating system and configure the Pi WiFi from a Terminal session on a Mac.

Prerequisites / Assumptions

You have:

  • A Mac with a SD card reader (either built in or an USB device).
  • A Raspberry Pi 3 B (A Pi 2 B with a compatible WiFi dongle works as well).
@jdecool
jdecool / behat.yml
Created May 7, 2017 10:39
Use Chrome Headless with Behat
default:
extensions:
Behat\MinkExtension:
base_url: http://localhost:8000
default_session: selenium2
selenium2:
browser: chrome
wd_host: http://127.0.0.1:4444/wd/hub
capabilities:
chrome: