Skip to content

Instantly share code, notes, and snippets.

View bsodmike's full-sized avatar

Michael de Silva bsodmike

View GitHub Profile
@brigand
brigand / app.js
Last active October 21, 2024 14:29
React JS Event-Emitter Mixin and Example
var React = require("react"), Dom = React.DOM;
var LogOutButton = require('./src/logout');
var events = require('api/events');
var Main = React.createClass({
// this mixin provides this.emitLogout, and if we set onLogout it'll be called when "logout" is emitted
mixins: [events.mixinFor("logout")],
getInitialState: function(){
return {
@anotheruiguy
anotheruiguy / web-fonts-asset-pipeline.md
Last active April 12, 2025 18:16
Custom Web Fonts and the Rails Asset Pipeline

Web fonts are pretty much all the rage. Using a CDN for font libraries, like TypeKit or Google Fonts, will be a great solution for many projects. For others, this is not an option. Especially when you are creating a custom icon library for your project.

Rails and the asset pipeline are great tools, but Rails has yet to get caught up in the custom web font craze.

As with all things Rails, there is more then one way to skin this cat. There is the recommended way, and then there are the other ways.

The recommended way

Here I will show how to update your Rails project so that you can use the asset pipeline appropriately and resource your files using the common Rails convention.

@plentz
plentz / nginx.conf
Last active May 3, 2025 05:27
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
@jtimberman
jtimberman / runit_service.rb
Last active December 20, 2015 10:39
Anatomy of a "plain defaults" runit_service resource, and its complimentary service resource (`:service_mirror`)
{
:name=>"plain-defaults",
# parameters specific to runit_service
:sv_bin => "/usr/bin/sv",
:sv_dir => "/etc/sv",
:service_dir => "/etc/service",
:lsb_init_dir => "/etc/init.d",
:control => [],
:options => {},
:env => {},
require 'minitest_helper'
ADDRESSES = {
toledo_ohio: {
street1: '',
city: 'Toledo',
state: '',
zip: '',
country: 'United States',
expected_obfuscated_street: '',
@teeparham
teeparham / hip_dizzle.sh
Last active December 18, 2015 04:39
command line aliases for dizzle & hipster
gem install ffaker
alias dizzle="ruby -e \"require 'ffaker'; puts Faker::DizzleIpsum.paragraph\" | tee >(pbcopy)"
alias hipster="ruby -e \"require 'ffaker'; puts Faker::HipsterIpsum.paragraph\" | tee >(pbcopy)"
###
$ dizzle
You talk too much like every single day Long Beach fo shizzle used to sell loot Coupe de Ville.
Real deal holyfield tha dizzle with my mind on my money fo shizzle. Real deal holyfield Mr. Buckwort
@johanneswuerbach
johanneswuerbach / .travis.yml
Last active March 24, 2025 17:40
Deploy an iOS app to testflight using Travis CI
---
language: objective-c
before_script:
- ./scripts/travis/add-key.sh
after_script:
- ./scripts/travis/remove-key.sh
after_success:
- ./scripts/travis/testflight.sh
env:
global:
@SFEley
SFEley / secret.rake
Created April 22, 2013 01:18
Open an encrypted data bag item in one's usual editor, decrypted. Adapted from Aaron Jensen's excellent script: https://gist.github.com/aaronjensen/4123044
namespace :secret do
desc "Edit an encrypted data bag item in EDITOR"
task :edit, :item do |t, args|
unless ENV['EDITOR']
puts "No EDITOR found. Try:"
puts "export EDITOR=vim"
exit 1
end
abort 'usage: rake "secret:edit[<item name>]"' unless args.item
# /etc/nginx/sites-available/app
upstream app_server {
server unix:/tmp/.unicorn_app.sock fail_timeout=0;
}
server {
listen 80;
server_name app.com;
@naan
naan / source_maps.rb
Last active December 14, 2015 13:48 — forked from alexspeller/source_maps.rb
Monkey patch for Coffee Script v.1.6.2 Source Maps for Rails.
# config/initializers/source_maps.rb
if Rails.env.development?
module CoffeeScript
class SourceMapError < StandardError; end;
class << self
def compile script, options
script = script.read if script.respond_to?(:read)