Skip to content

Instantly share code, notes, and snippets.

View teddyzetterlund's full-sized avatar

Teddy Zetterlund teddyzetterlund

View GitHub Profile
@lvivski
lvivski / jquery.mini.js
Created April 19, 2013 07:19
jQuery mini
function $(selector, context) {
return (context || document).querySelector(selector)
}
$.all = function (selector, context) {
return Array.prototype.slice.call(
(context || document).querySelectorAll(selector)
)
}
@LFabien
LFabien / README.md
Last active December 16, 2015 09:59
Git pre-commit hook

Git pre-commit hook

  • Remove whitespaces
  • Find files containing FOCUS()

Copy this file in .git/hooks and make it executable

  • chmod +x .git/hooks/pre-commit
@brandonb927
brandonb927 / LICENSE.md
Last active October 11, 2020 09:13 — forked from valpackett/LICENSE.md
Use Markdown in Evernote with Marked.app
       DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
               Version 2, December 2004

Copyright (C) 2012 Brandon B. [email protected]

Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long as the name is changed.

DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE

@henrik
henrik / 1. page.slim
Last active December 15, 2015 10:49
Working sketch of Rails i18n syntax for more easily passing in formatted (in your templating language) values, and also using multiple keys under the same scope (which is a good idea). Also see [a previous sketch with similar ideas](https://gist.github.com/henrik/4605425).
= t_scope(:"my.example.text") do |scope|
- scope.world do
span.worldly= my_world_helper
- scope.sign_up do
= link_to(scope.t(:sign_up), sign_up_path)
- scope.log_in do
= link_to(scope.t(:log_in), log_in_path)
@henrik
henrik / config-initializers-rails_overrides.rb
Last active December 14, 2015 15:38
Un-titlecase submit tag default value. E.g. "Create User" -> "Create user".
# Remove titlecase from submit tag default value.
# E.g. "Create User" -> "Create user".
class ActionView::Helpers::FormBuilder
def submit_default_value_with_titlecase_removal
old = submit_default_value_without_titlecase_removal
model = if object.class.respond_to?(:model_name)
object.class.model_name.human
else
@object_name.to_s.humanize
@desandro
desandro / bower-logo.md
Last active December 30, 2021 23:11
Bower logo

In addition to awesome docs #228, Bower deserves a proper logo. See below for sketches. I'm curious if you think any of these are worth me putting more effort into.


Take a look at Yeoman right now.

Screen Shot 2013-02-19 at 4 43 10 PM

The other two entities have awesome logos. Bower's got to represent.

@SlexAxton
SlexAxton / .zshrc
Last active June 6, 2025 19:18
My gif workflow
gifify() {
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
fi
else
@anthonyshort
anthonyshort / index.coffee
Last active December 12, 2015 09:08
tweets
window.tweetLoaded = (tweet) ->
document.querySelector('.tweet').innerHTML = tweet[0].text
@bloudermilk
bloudermilk / porvo.md
Last active December 12, 2015 04:18
PORVO: Plain old Ruby view objects (draft)
method PageHeaderHelper
  def page_header(title, subtitle = nil, &contents)
    PageHeader.new(self, title, subtitle, &contents)
  end

  class PageHeader
    attr_reader :context, :title, :subtitle

    def initialize(context, title, subtitle = nil)
@desandro
desandro / require-js-discussion.md
Created January 31, 2013 20:26
Can you help me understand the benefit of require.js?

I'm having trouble understanding the benefit of require.js. Can you help me out? I imagine other developers have a similar interest.

From Require.js - Why AMD:

The AMD format comes from wanting a module format that was better than today's "write a bunch of script tags with implicit dependencies that you have to manually order"

I don't quite understand why this methodology is so bad. The difficult part is that you have to manually order dependencies. But the benefit is that you don't have an additional layer of abstraction.