Skip to content

Instantly share code, notes, and snippets.

View luv2code's full-sized avatar
🥭
I like mangos

Matthew Taylor luv2code

🥭
I like mangos
View GitHub Profile
@luv2code
luv2code / ask.iced.coffee
Created March 22, 2012 03:49
iced-coffee-script console prompt
#! /home/matt/local/bin/iced
ask = (question, format, callback) ->
stdin = process.stdin
stdout = process.stdout
stdin.resume()
stdout.write(question + ": ")
stdin.once 'data', (data) ->
data = data.toString().trim()
@luv2code
luv2code / primes.go
Last active October 10, 2015 06:47
Problem with references?
package main
import "fmt"
func isPrimeDivisible(c int) bool {
prime := 0
for i := 0; i < prime_count; i++ {
prime = primes[i]
if (prime * prime) > c {
return false
var ko = window.ko;
if( !ko){
if(typeof window.require === 'function') {
try{
ko = require('ko');
} catch { /*ingore */ }
try{
ko = require('knockout');
} catch { /*ingore */ }
@luv2code
luv2code / ReadingChunked.go
Created June 18, 2013 17:37
resp.Body.Read(buf) always reads in spurts of 4K characters. I need it to be much smaller. so that the chunks come through immediately
resp, err := http.Get(url)
log.Printf("stream started: %s", url)
defer func () {
log.Printf("stream closing: %s", url)
resp.Body.Close()
}()
if err != nil {
panic(err)
}
@luv2code
luv2code / yammer.events.js
Last active December 31, 2015 13:18
changed the logic to show the more button from using a count to using an api provided flag.
(function () {
var activeTabClass = "yj-active-tab";
var eventsLink;
var lastId;
var column = yam.$('#column-two');
var mainColumn = column.find('.yj-main-content').empty();
var eventList = yam.$("<div id='event-list'>").appendTo(mainColumn);
eventList.click(function () { eventList.empty(); }); //empty the content if an event item is clicked.
@luv2code
luv2code / gulpfile.babel.js
Created August 15, 2017 20:45
gulp file with browserify uglify watchify source maps and livereload
import gulp from 'gulp'
import sourcemaps from 'gulp-sourcemaps'
import buffer from 'gulp-buffer'
import uglify from 'gulp-uglify'
import babel from 'babelify'
import watchify from 'gulp-watchify'
import livereload from 'gulp-livereload'
let watching = false