Skip to content

Instantly share code, notes, and snippets.

View jbutko's full-sized avatar

Jozef Butko jbutko

View GitHub Profile
@chrislkeller
chrislkeller / import_json_appsscript.js
Last active December 27, 2024 01:01
Adds what amounts to an =ImportJSON() function to a Google spreadsheet... To use go to Tools --> Script Editor and add the script and save.
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
@Integralist
Integralist / 1. Example Spec.js
Last active January 1, 2018 20:38
Mocking a Window object for unit-testing purposes
var mocks = {
resizeCalled: false,
createFakeWindow: function(width, height) {
var module = this;
return {
document: {
documentElement: {
clientWidth: width,
@jnwelzel
jnwelzel / search_form.scala.html
Created July 20, 2013 18:04
twitter bootstrap search form the way i like it
<div id="actions">
<form action="@link(0, "name")" method="GET" class="form-search">
<div class="input-append">
<input type="search" id="searchbox" name="f" value="@currentFilter" placeholder="Filter by device name..." class="input-medium search-query">
<button type="submit" id="device-search-submit" class="btn"><i class="icon-search"></i> Search</button>
</div>
</form>
</div>
@legenderrys
legenderrys / Barrel Mixitup Url Filter
Created September 24, 2013 22:31
Using Barrel's MixitUp jquery filter to automatically filter based on url hash
$('#grid').mixitup({
onMixLoad: function(){
var hash = window.location.hash;
var noHash=hash.replace("#","");
if(hash){
$('#grid').mixitup('filter', noHash);
}
}
});
@marcoslhc
marcoslhc / .editorconfig
Created October 13, 2013 06:36
editorconfig for JS + HTML + CSS
# editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
@thomascrenshaw
thomascrenshaw / gist:7080207
Last active July 11, 2016 20:07
This is how I installed node.js on DigitalOcean. Major things
The objective of this post is to get you from absolutely nothing, to a fully functional nodejs environment.
Software used: Ubuntu 12.10 x64, Nodejs v0.6.12, Nginx, MongoDB, Redis, and NPM modules.
1. Create new droplet using Ubuntu 12.10 x64
2. As root install
a. sudo apt-get install openssh-server
b. sudo apt-get install libssl-dev
c. sudo apt-get install git
d. sudo apt-get install g++
e. sudo apt-get install make
@pasupulaphani
pasupulaphani / nginx.conf
Created December 1, 2013 23:38
Configure Nginx: Load balancing and reverse proxy
### host file under sites-available ###
# The upstream module is the link between Node.js and Nginx.
# Upstream is used for proxying requests to other servers.
# All requests for / get distributed between any of the servers listed.
upstream app_nodeapp1 {
# Set up multiple Node.js webservers for Load balancing.
# max_fails refers to number of failed attempts
@thoop
thoop / nginx.conf
Last active April 14, 2025 17:11
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;
@tgdev
tgdev / social-snippet.html
Created January 11, 2014 00:27
Social media sharing snippet for facebook, twitter and pinterest. Place in <head> of your pages More info below: Facebook Open Graph tags - http://davidwalsh.name/facebook-meta-tags Twitter Cards - https://dev.twitter.com/docs/cards Pinterest Rich Pins - http://developers.pinterest.com/rich_pins/
<!-- Facebook Open Graph tags -->
<meta property="og:image" content="" />
<meta property="og:site_name" content="" />
<meta property="og:type" content="" />
<meta property="og:url" content="" />
<meta property="og:title" content="" />
<!-- Twitter Card -->
<meta name="twitter:card" content="summary" />
<meta name="twitter:creator" content="">
@johannes-weber
johannes-weber / ValidateFloat.js
Last active January 24, 2016 10:35
AngularJS Custom Float Validation
'use strict';
/**
* This directive parses both 1.2 and 1,2 into a valid float number 1.2.
* Note that you can't use input type number here as HTML5 browsers would
* not allow the user to type what it would consider an invalid number such as 1,2.
*
* <input ng-model="{yourModel}" validate-float />
*/
angular.module('Library').directive('validateFloat', function () {