Skip to content

Instantly share code, notes, and snippets.

View hacksalot's full-sized avatar
💭
levitating

hacksalot hacksalot

💭
levitating
  • United States
View GitHub Profile
@cms
cms / getStyle.js
Created April 17, 2010 00:48
Get computed styles
function getStyle(el, styleProp) {
var value, defaultView = el.ownerDocument.defaultView;
// W3C standard way:
if (defaultView && defaultView.getComputedStyle) {
// sanitize property name to css notation (hypen separated words eg. font-Size)
styleProp = styleProp.replace(/([A-Z])/g, "-$1").toLowerCase();
return defaultView.getComputedStyle(el, null).getPropertyValue(styleProp);
} else if (el.currentStyle) { // IE
// sanitize property name to camelCase
styleProp = styleProp.replace(/\-(\w)/g, function(str, letter) {
@mattd
mattd / gist:1006398
Created June 3, 2011 14:12
nginx try_files with a proxy_pass
server {
root /var/www/example.com/static;
server_name example.com;
access_log /var/log/nginx/example.com.access.log;
error_log /var/log/nginx/example.com.error.log;
try_files /maintenance.html @proxy;
location @proxy {
proxy_pass http://127.0.0.1:10001;
@jrburke
jrburke / gist:1262861
Created October 4, 2011 21:26
Universal (AMD/Node/plain browser) module
/**
* First, better, "set exports/return" option
*/
(function (define) {
//The 'id' is optional, but recommended if this is
//a popular web library that is used mostly in
//non-AMD/Node environments. However, if want
//to make an anonymous module, remove the 'id'
//below, and remove the id use in the define shim.
define('id', function (require) {
@mbostock
mbostock / .block
Last active April 8, 2024 13:46
Hello, D3!
license: gpl-3.0
@paulmillr
paulmillr / active.md
Last active June 24, 2024 13:58
Most active GitHub users (by contributions). http://twitter.com/paulmillr

Most active GitHub users (git.io/top)

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Wed, 21 Sep 2022 till Thu, 21 Sep 2023.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter(user => user.followers > 1000)
@audioplastic
audioplastic / nicks_observer.cpp
Created November 29, 2012 23:56
Super simple single threaded observer pattern for C++11
// C++11 style observer pattern implementation using lambda for scoped
// connection management.
//
// Copyright (c) 2012 Nick C.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
@dubik
dubik / BBox.cpp
Last active April 8, 2023 18:04
// Vectormath https://github.com/erwincoumans/sce_vectormath
class Ray
{
public:
Ray();
public:
Vectormath::Aos::Vector3 m_pos;
Vectormath::Aos::Vector3 m_dir;
Vectormath::Aos::Vector3 m_invDir; // 1.0f / m_dir per elem
float m_min;
@hacksalot
hacksalot / gist:746c3290a7c2e077ed91
Last active February 25, 2019 15:39
Install Ruby/DevKit + Jekyll on Windows

Install Ruby 2.1.5

  1. Install [Ruby 2.1.5 for Windows (x64)][1] from [RubyInstaller.org][2].

    • Set Install Tcl/Tk support.
    • Set Add Ruby executables to your path
    • Set Associate .rb and .rbw files with this Ruby installation.
    • Do NOT include whitespaces in the destination folder.
  2. Run ruby -v to verify command line access and version.

@davidrapin
davidrapin / jsonError.js
Last active April 18, 2024 19:16
Extract a detailed JSON parse error (with line and column) in nodejs
'use strict';
var clarinet = require('clarinet');
/**
* Extract a detailed JSON parse error
* using https://github.com/dscape/clarinet
*
* @param {string} json
* @returns {{snippet:string, message:string, line:number, column:number, position:number}} or undefined if no error
*/
@bellbind
bellbind / app.html
Created May 20, 2015 07:23
[electron]Use electron as a Web Server
<!doctype html>
<html><head><script src="app.js"></script></head><body></body></html>