Skip to content

Instantly share code, notes, and snippets.

View danielberkompas's full-sized avatar

Daniel Berkompas danielberkompas

View GitHub Profile
@dnegstad
dnegstad / Brocfile.js
Last active January 2, 2019 17:50
Polymer WebComponents in ember-cli >= 0.0.41
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
var pickFiles = require('broccoli-static-compiler');
var mergeTrees = require('broccoli-merge-trees');
var vulcanize = require('broccoli-vulcanize');
var app = new EmberApp();
var polymerVulcanize = vulcanize('app', {
input: 'elements.html',
output: 'assets/vulcanized.html',
@grugq
grugq / gist:03167bed45e774551155
Last active June 17, 2025 15:52
operational pgp - draft

Operational PGP

This is a guide on how to email securely.

There are many guides on how to install and use PGP to encrypt email. This is not one of them. This is a guide on secure communication using email with PGP encryption. If you are not familiar with PGP, please read another guide first. If you are comfortable using PGP to encrypt and decrypt emails, this guide will raise your security to the next level.

@walkerjeffd
walkerjeffd / Synology-Diskstation-Git.md
Last active June 19, 2025 11:43
Instructions for setting up git server on Synology Diskstation

Configure Synology NAS as Git Server

Instructions for setting up a git server on a Synology NAS with Diskstation. Specifically, I am using a DS414 with DSM 5.0.

Set Up User and Folder

  • Create user gituser via Diskstation interface (with File Station and WebDAV privilages)
  • Add new shared folder called git (located at /volume1/git) with read/write access for gituser and admin. This folder will hold all the repos.
  • Install Git Server package via Diskstation
@qxjit
qxjit / romeo.idr
Created May 2, 2014 17:32
Romeo & Juliet made safe
data Health = JustFine | LooksDead | IsDead
record Character : Type where
MkCharacter : (name:String) ->
(health:Health) ->
Character
instance Show Health where
show IsDead = "is dead"
show LooksDead = "looks dead"
@sdthornton
sdthornton / test_ajax_deferred.js
Last active September 6, 2018 08:00
Testing jQuery.ajax with deferred method - .done() and .fail()
// Probably best to have this within setup
var ajaxStub = sinon.stub($, "ajax", function(event) {
var result = $.Deferred();
result.args = event;
return result;
});
// Usage example
var call = theAjaxCallToTest()
// OR (if theAjaxCallToTest() doesn't return the actual ajax call)
@eliotsykes
eliotsykes / asset_server_middleware.rb
Last active December 20, 2015 01:29
***** Checkout the rack-zippy gem, I recommend it over this gist, find it at https://github.com/eliotsykes/rack-zippy ***** An asset server for Rails 3.2.x that serves asset pipeline precompiled assets to clients, including those elusive gzipped (.gz) assets. Sadly Rails' own ActionDispatch::Static middleware does not take care of serving gzippe…
# 1. Add rack-rewrite to your Gemfile and run 'bundle install':
# gem 'rack-rewrite'
#
# 2. Create a file with the contents below in config/initializers/asset_server_middleware.rb
#
# 3. Rename 'YourApp' below
#
# 4. In config/environments/production.rb and config/environments/test.rb, set:
# config.serve_static_assets = true
# config.assets.compile = false
@kates
kates / search_and_replace.sh
Last active August 31, 2019 05:22
bulk search and replace with the silver searcher, awk, sed and xargs
ag "sometext" --nogroup | awk '{print substr($1,1,index($1,":")-1);}' | xargs -I {} sed -i .bak -e 's/sometext/anothertext/g' {}
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active June 27, 2025 20:44
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@pixeltrix
pixeltrix / ruby-1.9.3p362-segfault.rb
Created January 2, 2013 11:10
Simple script to reproduce segfaults with Active Record in ruby-1.9.3p362. This style of scope is used by the kaminari gem to define its page scope - using a class method to define default_scope doesn't segfault.
require 'active_record'
ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
ActiveRecord::Schema.define(:version => 1) do
create_table :posts do |t|
t.string :title
t.timestamps
end
end
@danielberkompas
danielberkompas / best_practices.md
Created December 14, 2012 15:21
An article about the best way to use Rspec.

Best Practices

How to Test Classes

  require "spec_helper"
  
  describe ClassName do
  
    # Describe each method on your class.
    # Note that the `describe` call limits the scope