Skip to content

Instantly share code, notes, and snippets.

View inkdeep's full-sized avatar

Jeremy Kleindl inkdeep

View GitHub Profile

One-liners

Reverse every line:

Input file:

$ cat foo
qwe
123

bar

@inkdeep
inkdeep / gist:9882904
Last active August 29, 2015 13:57 — forked from Mithrandir0x/gist:3639232
angular service/factory/provider styles
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/
// author: Pawel Kozlowski
var myApp = angular.module('myApp', []);
//service style, probably the simplest one
myApp.service('helloWorldFromService', function() {
this.sayHello = function() {
return "Hello, World!"
namespace :test do
task :populate_testopts do
if ENV['TESTNAME'].present?
ENV['TESTOPTS'] = ENV['TESTOPTS'] ? "#{ENV['TESTOPTS']} " : ''
ENV['TESTOPTS'] += "--name=#{ENV['TESTNAME'].inspect}"
end
end
end
%w(test:units test:functionals test:integration).each do |task_name|
@inkdeep
inkdeep / annoying.js
Created June 1, 2011 17:25 — forked from Kilian/annoying.js
How to be an asshole
/**
* Annoying.js - How to be an asshole to your users
*
* DO NOT EVER, EVER USE THIS.
*
* Copyright (c) 2011 Kilian Valkhof (kilianvalkhof.com)
* Visit https://gist.github.com/767982 for more information and changelogs.
* Visit http://kilianvalkhof.com/2011/javascript/annoying-js-how-to-be-an-asshole/ for the introduction and weblog
* Check out https://gist.github.com/942745 if you want to annoy developer instead of visitors
*
// Finds the longest common starting substring in an array of strings
function common_substring(data) {
var i, ch, memo, idx = 0
do {
memo = null
for (i=0; i < data.length; i++) {
ch = data[i].charAt(idx)
if (!ch) break
if (!memo) memo = ch
else if (ch != memo) break
require 'colored'
def banner(title, pad = 85)
puts "\n#{title} ".ljust(pad, "*").yellow
end
def stripe
puts ("-" * 84 + "\n").yellow
end