Skip to content

Instantly share code, notes, and snippets.

View jasan-s's full-sized avatar

Jasan jasan-s

View GitHub Profile
@wosephjeber
wosephjeber / ngrok-installation.md
Last active May 6, 2024 20:19
Installing ngrok on Mac

Installing ngrok on OSX

For Homebrew v2.6.x and below:

brew cask install ngrok

For Homebrew v2.7.x and above:

var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@yoavniran
yoavniran / ultimate-ut-cheat-sheet.md
Last active May 6, 2024 12:29
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai, Sinon, and Jest
@devjin0617
devjin0617 / .manifest
Created May 19, 2017 15:15
chrome extension using a content script to access the `window` object
{
"content_scripts": [
{
"matches": ["http://*/*", "https://*/*"],
"js": ["inject.js"],
"all_frames": true
}
],
"web_accessible_resources": [
"content.js"
@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@ryancat
ryancat / colorDiffUtil.js
Created May 9, 2018 06:07
Color difference in RGB and LAB
/**
* Compare color difference in RGB
* @param {Array} rgb1 First RGB color in array
* @param {Array} rgb2 Second RGB color in array
*/
export function deltaRgb (rgb1, rgb2) {
const [ r1, g1, b1 ] = rgb1,
[ r2, g2, b2 ] = rgb2,
drp2 = Math.pow(r1 - r2, 2),
dgp2 = Math.pow(g1 - g2, 2),
@vlucas
vlucas / encryption.js
Last active April 2, 2024 14:26
Stronger Encryption and Decryption in Node.js
'use strict';
const crypto = require('crypto');
const ENCRYPTION_KEY = process.env.ENCRYPTION_KEY; // Must be 256 bits (32 characters)
const IV_LENGTH = 16; // For AES, this is always 16
function encrypt(text) {
let iv = crypto.randomBytes(IV_LENGTH);
let cipher = crypto.createCipheriv('aes-256-cbc', Buffer.from(ENCRYPTION_KEY), iv);
@igorbenic
igorbenic / gateway.php
Last active February 21, 2024 21:32
How to create a custom WooCommerce Payment Gateway
<?php
// ...
function woo_payment_gateway() {
class Woo_PayPal_Gateway extends WC_Payment_Gateway {
}
}
@mikelehen
mikelehen / generate-pushid.js
Created February 11, 2015 17:34
JavaScript code for generating Firebase Push IDs
/**
* Fancy ID generator that creates 20-character string identifiers with the following properties:
*
* 1. They're based on timestamp so that they sort *after* any existing ids.
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs.
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly).
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the
* latter ones will sort after the former ones. We do this by using the previous random bits
* but "incrementing" them by 1 (only in the case of a timestamp collision).
*/
@kosiara
kosiara / HowToInstallGPOnAnEmulator.txt
Last active November 26, 2023 13:01
Android - Install Google Play Services / Google Play on android emulator
1. Download Google Apps from basketbuild.com:
https://basketbuild.com/gapps
2. Extract GPE services apk files from the zip:
unzip -j gapps-lp-20150222-signed.zip system/priv-app/GoogleServicesFramework/GoogleServicesFramework.apk system/priv-app/GoogleLoginService/GoogleLoginService.apk system/priv-app/Phonesky/Phonesky.apk system/priv-app/GmsCore/GmsCore.apk -d ./
3. Start the emulator with the command:
/home/path/to/your/android/Sdk/tools/emulator -no-boot-anim -netdelay none -netspeed full -avd YOUR_EMULATOR_NAME