Skip to content

Instantly share code, notes, and snippets.

@mhawksey
mhawksey / gist:1276293
Last active October 23, 2023 09:00
Google App Script to insert data to a google spreadsheet via POST or GET - updated version as per https://mashe.hawksey.info/2014/07/google-sheets-as-a-database-insert-with-apps-script-using-postget-methods-with-ajax-example/
/*
Copyright 2011 Martin Hawksey
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@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"
@pheuter
pheuter / gist:3515945
Created August 29, 2012 17:33
Handlebars.js equality check in #if conditional

Handlebars.js is a template framework for Javascript environments. It allows the construction of HTML elements using HTML and expressions wrapped in {{ }}

Limitations of {{if}}

One of the conditional block helpers Handlebars offers is the {{#if}}.

For example:

<div class="entry">
@AlexKMDev
AlexKMDev / bash
Last active December 14, 2015 16:38
Change hostname on Mac OS X 10.8.2 > [hostname]:~ [username]$
sudo scutil --set HostName [hostname]
@Virakal
Virakal / persist-directive
Created July 31, 2013 16:28
Automatically persist Angular ng-models between sessions using local storage.
/**
* Usage examples:
*
* <input type="text" ng-model="someText" persist></input>
*
* You can also specify a type to cast the value to:
* <input type="num" ng-model="aNumber" persist="int"></input>
*
* Valid types include:
*
@plentz
plentz / nginx.conf
Last active July 22, 2024 11:19
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@bomberstudios
bomberstudios / sketch-plugins.md
Last active February 26, 2024 07:02
A list of Sketch plugins hosted at GitHub, in no particular order.
@subzey
subzey / readme.md
Last active December 6, 2017 14:16
Про это

Про это

Как вы называете переменную, когда нужно сохранить this в замыкании?

Вопрос не праздный, ведь это дело даже не личного вкуса, а, скорее, договоренности. В коде проекта, над которым я сейчас активно работаю, можно было с равной степенью вероятности встретить that и self. Через два года разработки, впрочем, баланс заметно сместился в сторону that.

Но знаете, что? И self, и that, и даже _this с me — это очень хреновые названия.

@thoop
thoop / nginx.conf
Last active December 8, 2023 21:55
Official prerender.io nginx.conf for nginx
# Change YOUR_TOKEN to your prerender token
# Change example.com (server_name) to your website url
# Change /path/to/your/root to the correct value
server {
listen 80;
server_name example.com;
root /path/to/your/root;
index index.html;