Skip to content

Instantly share code, notes, and snippets.

View sajoku's full-sized avatar
🏠
Working from home

Sander sajoku

🏠
Working from home
View GitHub Profile
@zerowidth
zerowidth / coffeescript.rb
Created April 8, 2013 03:16
Jekyll plugins for rendering compass stylesheets and auto-converting coffeescript files without requiring YAML front-matter.
require "coffee-script"
module Jekyll
# Automatically force coffeescript files to be compiled, even if they don't
# have the YAML front-matter.
class CoffeeConvertor < Generator
def generate(site)
converted = []
site.static_files.each do |sf|
# -*- coding: utf-8 -*-
$:.unshift("/Library/RubyMotion/lib")
require 'motion/project'
require 'motion-cocoapods'
require 'bundler'
Bundler.require
Dir.glob('lib/tasks/*.rake').each { |r| import r }
VERSION = "1.0.2"
@jonasschmidt
jonasschmidt / pre-commit
Last active September 6, 2024 15:32
git pre-commit hook checking for RSpec :focus tags that were unintentionally left in the specs
#!/usr/bin/env ruby
if `git diff --cached spec` =~ /,\s?(:focus|focus:\s?true|:focus\s?=>\s?true)/
puts "\e[31mPlease focus and remove your :focus tags before committing :)"
exit 1
end
@neara
neara / forms.py
Last active June 10, 2024 15:30
Django Class Based Views and Inline Formset Example
from django.forms import ModelForm
from django.forms.models import inlineformset_factory
from models import Sponsor, Sponsorship
class SponsorForm(ModelForm):
class Meta:
model = Sponsor
@plentz
plentz / nginx.conf
Last active April 15, 2025 03:44
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@weakish
weakish / README.md
Last active September 27, 2020 20:09
#harden #debian

Hardening your Debian VPS

Introduction

This is a basic guide on hardening your Debian VPS. And Ubuntu users may also find this guide useful, since Ubuntu is based on Debian.

Don't panic!

@dedy-purwanto
dedy-purwanto / gist:11312110
Created April 26, 2014 05:00
Bulk remove iTerm2 color schemes.
# There was a day where I have too many color schemes in iTerm2 and I want to remove them all.
# iTerm2 doesn't have "bulk remove" and it was literally painful to delete them one-by-one.
# iTerm2 save it's preference in ~/Library/Preferences/com.googlecode.iterm2.plist in a binary format
# What you need to do is basically copy that somewhere, convert to xml and remove color schemes in the xml files.
$ cd /tmp/
$ cp ~/Library/Preferences/com.googlecode.iterm2.plist .
$ plutil -convert xml1 com.googlecode.iterm2.plist
$ vi com.googlecode.iterm2.plist
@willrax
willrax / my_scene.rb
Last active August 29, 2015 14:01
Parallax scrolling with Sprite Kit and RubyMotion
# Video of it in action: http://cl.ly/VSIF
class MyScene < SKScene
def scroll_action(x, duration)
width = (x * 2)
move = SKAction.moveByX(-width, y: 0, duration: duration * width)
reset = SKAction.moveByX(width, y: 0, duration: 0)
SKAction.repeatActionForever(SKAction.sequence([move, reset]))
end
##
# Helpers for randomized person testing.
module PersonsHelper
##
# Generate the next n elements for the array, but in a predefined manner.
class FakeElementGenerator
##
# Generate elements, the first of which must be start_with.
def initialize(start_with:)
@start = start_with
@mesuutt
mesuutt / chart.html
Last active March 23, 2021 02:08
Chart.js - Doughnut chart with custom legend http://codepen.io/mesuutt/pen/LbyPvr
<div class="canvas-con">
<div class="canvas-con-inner">
<canvas id="mychart" height="250px"></canvas>
</div>
<div id="my-legend-con" class="legend-con"></div>
</div>