Skip to content

Instantly share code, notes, and snippets.

View influx6's full-sized avatar
🎯
Focusing

Ewetumo Alexander influx6

🎯
Focusing
View GitHub Profile
@influx6
influx6 / hasOwnPropertyshim
Created September 12, 2012 20:57
HasOwnProperty Shim
In my heavy search to both understand the underline code and functionality of most
of the libraries i am building and managing,the one pure function that seems to have always eluded me was the hasOwnProperty function attributed to all JS objects.
I know browser support is widespread and i thank God for that,but am not the
type to just use something i don't understand,after a long,
mind bending,play testing in the js console to both understand how the prototyping system
works,how and why new objects point directly to the prototype,i finally came up with a shim that works 90% of the time even far more better than that located in the Modernizr annotated source code,ya you heard me better.
It seems the trick was really on how prototypes and constructors are
assigned and also depends on you how deep you wish to go into that tree,since the 'in'(for in loop and others) handle going deep within the prototype
and object tree there is not need to try to recreate that,therefore this function searches only one level
@influx6
influx6 / gist:3763937
Created September 21, 2012 21:14
Iterator payload
iterable: function(collection,eachfunc,finish){
if(!collection || !eachfunc) return;
//handles management of next call for collection,be it arrays or objects
var len,keys,self = this,isArray = false;
if(this.isObject(collection)){ keys = this.keys(collection); len = keys.length; }
if(this.isArray(collection)){ isArray = true; len = collection.length;}
eachfunc.collection = collection;
eachfunc.size = len;
eachfunc.__ri__ = len - 1;
06/24/2013 01:35:22 AM - Enabling debug logging
06/24/2013 01:35:22 AM - i3 4.5.1 (2013-03-18, branch "tags/4.5.1") starting
06/24/2013 01:35:22 AM - main.c:main:527 - root_depth = 24, visual_id = 0x00000021.
06/24/2013 01:35:22 AM - Parsing configfile /home/punchy/.i3/config
deciding for version 4 due to this line: # i3 config file (v4)
06/24/2013 01:35:22 AM - config_parser.c:parse_config:315 - CONFIG(line 1): # i3 config file (v4)
06/24/2013 01:35:22 AM - config_parser.c:parse_config:315 - CONFIG(line 2): #
06/24/2013 01:35:22 AM - config_parser.c:parse_config:315 - CONFIG(line 3): # Please see http://i3wm.org/docs/userguide.html for a complete reference!
06/24/2013 01:35:22 AM - config_parser.c:parse_config:315 - CONFIG(line 4): #
06/24/2013 01:35:22 AM - config_parser.c:parse_config:315 - CONFIG(line 5): # This config file uses keycodes (bindsym) and was written for the QWERTY
06/24/2013 01:35:22 AM - Enabling debug logging
06/24/2013 01:35:22 AM - i3 4.5.1 (2013-03-18, branch "tags/4.5.1") starting
06/24/2013 01:35:22 AM - main.c:main:527 - root_depth = 24, visual_id = 0x00000021.
06/24/2013 01:35:22 AM - Parsing configfile /home/punchy/.i3/config
deciding for version 4 due to this line: # i3 config file (v4)
06/24/2013 01:35:22 AM - config_parser.c:parse_config:315 - CONFIG(line 1): # i3 config file (v4)
06/24/2013 01:35:22 AM - config_parser.c:parse_config:315 - CONFIG(line 2): #
06/24/2013 01:35:22 AM - config_parser.c:parse_config:315 - CONFIG(line 3): # Please see http://i3wm.org/docs/userguide.html for a complete reference!
06/24/2013 01:35:22 AM - config_parser.c:parse_config:315 - CONFIG(line 4): #
06/24/2013 01:35:22 AM - config_parser.c:parse_config:315 - CONFIG(line 5): # This config file uses keycodes (bindsym) and was written for the QWERTY
06/24/2013 01:35:22 AM - Enabling debug logging
06/24/2013 01:35:22 AM - i3 4.5.1 (2013-03-18, branch "tags/4.5.1") starting
06/24/2013 01:35:22 AM - main.c:main:527 - root_depth = 24, visual_id = 0x00000021.
06/24/2013 01:35:22 AM - Parsing configfile /home/punchy/.i3/config
deciding for version 4 due to this line: # i3 config file (v4)
06/24/2013 01:35:22 AM - config_parser.c:parse_config:315 - CONFIG(line 1): # i3 config file (v4)
06/24/2013 01:35:22 AM - config_parser.c:parse_config:315 - CONFIG(line 2): #
06/24/2013 01:35:22 AM - config_parser.c:parse_config:315 - CONFIG(line 3): # Please see http://i3wm.org/docs/userguide.html for a complete reference!
06/24/2013 01:35:22 AM - config_parser.c:parse_config:315 - CONFIG(line 4): #
06/24/2013 01:35:22 AM - config_parser.c:parse_config:315 - CONFIG(line 5): # This config file uses keycodes (bindsym) and was written for the QWERTY
# OSX for Hackers (Mavericks/Yosemite)
#
# Source: https://gist.github.com/brandonb927/3195465
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Ask for the administrator password upfront
package main
import (
"flag"
"log"
"gopkg.in/lxc/go-lxc.v2"
"fmt"
)
@influx6
influx6 / main.go
Last active August 29, 2015 14:24 — forked from jmervine/main.go
// safeSplit handles quoting well for commands for use with github.com/jmervine/exec/v2
//
// Examples:
// > safeSplit("/bin/bash bash -l -c 'echo \"foo bar bah bin\"'")
// => []string{"/bin/bash", "-l", "-c", "echo \"foo bar bah bin\""}
// > safeSplit("docker run --rm -it some/image bash -c \"npm test\"")
// => []string{"docker", "run", "--rm", "-it", "some/image", "bash", "-c", "npm test"}
//----
// package main
// import "github.com/jmervine/exec/v2"
@influx6
influx6 / Vagrantfile
Last active September 14, 2015 00:20
Freshia Vagrant file
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
@influx6
influx6 / parser_noaa_forecasts.go
Last active January 4, 2016 13:39
A gist of a forecast parser for the NOAA Coastal Marine forecast txt files
package main
import (
"bufio"
"encoding/json"
"errors"
"fmt"
"io"
"net/http"
"regexp"