Skip to content

Instantly share code, notes, and snippets.

View nazgob's full-sized avatar
🎯
Focusing

Przemek Owczarek nazgob

🎯
Focusing
View GitHub Profile
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active May 30, 2024 08:12
A badass list of frontend development resources I collected over time.
@georgebrock
georgebrock / 1.js
Created March 18, 2013 14:09
Stockholm Vim: Vim Golf challenges
// Before
function foo(hello, world,
how, are,
you) {
}
// After
function foo(parameters) {
var hello = parameters.hello;
@flypiggy
flypiggy / test.sml
Created January 24, 2013 01:10
change the assignment name then "$sml test.sml" to make test
use "assignment1.sml";
(* assert for test *)
fun assert (e: bool, message: string) =
let val prefix = "Testing [" ^ message ^ "]"
in if e then print( prefix ^ "----PASS\n")
else print(prefix ^ "----FAIL\n")
end
(* factroies for Q1-Q5 *)
@themusicman
themusicman / include-experiments.rb
Created July 5, 2012 23:35
Experiments with Module Includes in Ruby
# I created a generic Rails like ApplicationController so that you can just
# run this code via a command line prompt without the need for Rails
module Recorder
def self.included(base)
base.send(:before_filter, :some_method)
base.send(:after_filter, :another_method)
end
@applicake
applicake / app_spec.rb
Created March 10, 2012 15:24
le spec aliases
require 'spec_helper'
require 'rack/test'
describe App do
include Rack::Test::Methods
le_me { Object.new }
le(:app) { App }

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@marcinbunsch
marcinbunsch / true_dat.rb
Created February 23, 2012 19:08
True#dat
class TrueClass
def dat
self
end
end
true.dat # => true
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Blue Component</key>
<real>0.0</real>
<key>Green Component</key>
<real>0.0</real>
@sirupsen
sirupsen / explain.rb
Created December 6, 2011 06:35
.ircrb entry to run explain on a query.
if defined? ActiveRecord
def explain(query)
query = query.to_sql if query.is_a?(ActiveRecord::Relation)
ActiveRecord::Base.connection
.execute("EXPLAIN ANALYZE #{query}")
.to_a
.each { |hash| puts hash["QUERY PLAN"] }
nil
@teeparham
teeparham / pingup.rb
Created July 28, 2011 15:54
Ruby ping logger
server = "google.com"
cmd = "ping -c 1 #{server}"
while true do
`#{cmd}`
if ($?.exitstatus != 0)
puts "Down: " + Time.now.to_s
while ($?.exitstatus != 0) do
`#{cmd}`
end
puts "Up: " + Time.now.to_s