Skip to content

Instantly share code, notes, and snippets.

View DimitarChristoff's full-sized avatar

Dimitar Christoff DimitarChristoff

View GitHub Profile
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@cobyism
cobyism / gh-pages-deploy.md
Last active May 7, 2024 18:46
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@domenic
domenic / promises.md
Last active March 31, 2024 14:07
You're Missing the Point of Promises

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.
@getify
getify / gist:5226305
Last active January 7, 2024 11:59
playing around with an `Object.make()` helper
// `Object.make(..)` is a helper/wrapper for `Object.create(..)`. Both create a new
// object, and optionally link that new object's `[[Prototype]]` chain to another object.
//
// But `Object.make(..)` makes sure the new object always has a `__proto__` property
// (even a null one) and delegation to a `isPrototypeOf(..)` method, both of which are
// missing from the bare object (aka "Dictionary") created by `Object.create(null)`.
//
// `isPrototypeOf()` is put on a extra object that your created object can delegate to,
// if any only if you create an empty object (by not passing a `linkTo`) that otherwise
// wouldn't have access to `isPrototypeOf()`.
@ozh
ozh / server.cfg
Last active August 22, 2022 00:00
Quakelive Server Config
// Servers have the ability to run multiple gametypes, known as "factories." You should not add gameplay related
// cvars in the server config: they may get overwritten by the factory. For creating your own sets of gameplay rules,
// create a file ending in ".factories" inside baseq3/scripts, and refer to "Creating custom gametypes" in the
// server_readme.txt file.
// Be aware that factories can override any cvar, including ones specified in this config file.
set sv_hostname "SARL | CA | elo+stats | GLHF"
set sv_tags "clanarena, qlstats.net, ELO, SARL, no-whiners, glhf" // Comma delimited field of server tags to show in server browser.
@haf
haf / install-git.sh
Created August 22, 2012 14:38
Installing git and git-subtree from source in ubuntu as packages
# use with: curl -L https://raw.github.com/gist/3426227 | bash
# get git binary, then git with git
sudo apt-get install git -y
git clone https://github.com/git/git.git
# remove your binary/package
sudo apt-get remove git -y
sudo apt-get install make checkinstall libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev asciidoc -y
@mikermcneil
mikermcneil / example-of-how-to-import-data-into-sails-app.js
Last active March 23, 2020 10:59
An example script that imports data from a JSON file into a Sails.js app (feel free to use as a seed/boilerplate script, whatever you like)
#!/usr/bin/env node
/**
* Module dependencies
*/
var Async = require('async');
var Filesystem = require('machinepack-fs');
var Prompts = require('machinepack-prompts');
var Sails = require('sails').Sails;
@timwienk
timwienk / irc-notify.js
Last active January 27, 2017 17:50
Simple IRC notify script, sic (http://tools.suckless.org/sic) inspired.
#!/usr/bin/env node
"use strict"
var connection = null,
buffer = '',
listeners = {};
var options = {
host: 'chat.freenode.net',
port: 6667,
@getify
getify / ex1-prototype-style.js
Last active September 7, 2016 16:24
A comparison of prototype-style of coding objects and Object.create()-style of coding objects. Both code snippets create two objects `b1` and `b2` which are `prototype` linked to behaviors defined by `Foo` and `Bar`. Take a look at both code snippets to see the pros and cons of each style of code, and decide for yourself which one is simpler to …
function Foo(who) {
this.me = who;
}
Foo.prototype.identify = function() {
return "I am " + this.me;
};
function Bar(who) {
Foo.call(this,who);

{{recruiter}},

On {{dates}} the attached messages were sent to my private email address. This email was unsolicited commercial email and, since we have never had any dealings previously, was unlawfully sent.

In particular, it was contrary to section 22 of The Privacy and Electronic Communications (EC Directive) Regulations, (SI2426/2003) ["PECR"]. In addition, this action breaches your obligations under the Data Protection Act 1998, as there was no consent to process the personal data comprised by the personal email address. As the affected data subject I require you to:

  1. Confirm whether you are registered as a data controller under the Data Protection Act 1998, and if so, explain how this activity complies with your registration.
  2. Cease any processing or sale of my data for all purposes, including direct marketing.
  3. Provide a copy of all data you hold which relates to me.
  4. Erase any personal data you hold about me.