Skip to content

Instantly share code, notes, and snippets.

View harryadel's full-sized avatar

Harry Adel harryadel

View GitHub Profile
@nikcub
nikcub / README.md
Created October 4, 2012 13:06
Facebook PHP Source Code from August 2007
@chrisjhoughton
chrisjhoughton / wait-el.js
Last active April 17, 2025 08:14
Wait for an element to exist on the page with jQuery
var waitForEl = function(selector, callback) {
if (jQuery(selector).length) {
callback();
} else {
setTimeout(function() {
waitForEl(selector, callback);
}, 100);
}
};
@joepie91
joepie91 / vpn.md
Last active May 18, 2025 03:24
Don't use VPN services.

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

  • A Russian translation of this article can be found here, contributed by Timur Demin.
  • A Turkish translation can be found here, contributed by agyild.
  • There's also this article about VPN services, which is honestly better written (and has more cat pictures!) than my article.
@renshuki
renshuki / ubuntu_agnoster_install.md
Last active December 30, 2024 16:16
Ubuntu 16.04 + Terminator + Oh My ZSH with Agnoster Theme

Install Terminator (shell)

sudo add-apt-repository ppa:gnome-terminator
sudo apt-get update
sudo apt-get install terminator

Terminator should be setup as default now. Restart your terminal (shortcut: "Ctrl+Alt+T").

Install ZSH

@jayceekay
jayceekay / test_server.js
Created April 21, 2016 02:06
attempting to write an integration test for a simple loopback api
var assert = require('chai').assert;
var status = require('http-status');
var app = require('../server/server');
var request = require('supertest');
var boot = require('loopback-boot');
var DataSource = require('loopback-datasource-juggler').DataSource;
request = request('http://0.0.0.0:3000/api');
describe('Metrics resource', function() {
@dr-dimitru
dr-dimitru / deploy.sh
Last active November 4, 2019 08:08
Deploy Meteor + Phusion Passenger + nginx
#!/bin/bash
rsync -auhiP -e 'ssh -p {sshPort}' /path/to/app/myApp.tar.gz user@host:/home/meteoruser/
@joepie91
joepie91 / random.md
Last active April 11, 2025 09:42
Secure random values (in Node.js)

Not all random values are created equal - for security-related code, you need a specific kind of random value.

A summary of this article, if you don't want to read the entire thing:

  • Don't use Math.random(). There are extremely few cases where Math.random() is the right answer. Don't use it, unless you've read this entire article, and determined that it's necessary for your case.
  • Don't use crypto.getRandomBytes directly. While it's a CSPRNG, it's easy to bias the result when 'transforming' it, such that the output becomes more predictable.
  • If you want to generate random tokens or API keys: Use uuid, specifically the uuid.v4() method. Avoid node-uuid - it's not the same package, and doesn't produce reliably secure random values.
  • If you want to generate random numbers in a range: Use random-number-csprng.

You should seriously consider reading the entire article, though - it's

@doublemarked
doublemarked / 01:unit-tests-example.js
Last active February 6, 2019 22:07
Testing Loopback Projects (a simplified extraction)
// File Location: test/unit/user/
const appRoot = require('app-root-path')
const bootstrap = appRoot.require('/test/bootstrap')
const expect = bootstrap.expect
describe('Example Unit Tests', function () {
const User = bootstrap.app.models.User
@Davor111
Davor111 / sshuttle.sh
Created February 17, 2017 08:34
How to use sshuttle with .key, .csr or .pem files for authentication
#It's not directly mentioned in the documentation on how to do this, so here you go. This command will tunnel everything including DNS:
sshuttle --dns -vr [email protected] 0/0 --ssh-cmd 'ssh -i /your/key/path.pem'
@Kovrinic
Kovrinic / .gitconfig
Last active May 13, 2025 07:15
git global url insteadOf setup
# one or the other, NOT both
[url "https://github"]
insteadOf = git://github
# or
[url "[email protected]:"]
insteadOf = git://github