Skip to content

Instantly share code, notes, and snippets.

span_trans = lambda do |el|
if el[:node].name == "span"
if el[:node].has_attribute?("style")
rules = el[:node].attribute("style").value.split(";")
new_rules = rules.map do |rule|
rule.match(/text-decoration:\s*(underline|overline|line-through)\b/) ||
rule.match(/font-weight:\s*bold\b/) ||
rule.match(/font-style:\s*italic\b/)
end
new_style = new_rules.compact.map{|r| r.to_s}.join("; ")
@vojtajina
vojtajina / angular-bind-title.html
Created June 13, 2011 12:56
Angular - binding title example
<!DOCTYPE HTML>
<html xmlns:ng="http://angularjs.org" ng:controller="Main">
<head>
<title ng:bind-template="Prefix: {{pageTitle}}"></title>
<script type="text/javascript" src="build/angular.js" ng:autobind></script>
<script type="text/javascript">
function Main(){}
function Child(){}
</script>
@lucasfais
lucasfais / gist:1207002
Created September 9, 2011 18:46
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@sr75
sr75 / centos6-barebones-vps-rails-server-walkthrough
Last active October 2, 2015 12:38
centos6-barebones-vps-rails-server-walkthrough (rvm, nginx, mysql, memcached)
# CentOS 6.4 barebones walkthrough guide for a new vps rails server instance
# assumes you already have a personal ssh key locally
#
# script implements the following security approaches:
# disables root login
# configures ssh setup for deployer user
# opens up standard ports
#
# setup includes:
# rvm & ruby-1.9.3-p429
@mystix
mystix / setup-php-dev.sh
Last active April 27, 2023 15:46
(OSX 10.7.x/10.8.x + Homebrew + nginx + mysql + php 5.4 + php-fpm + apc + xdebug) development environment
#!/bin/bash
# install homebrew's official php tap
brew tap josegonzalez/homebrew-php
# install homebrew-dupes (required to install zlib, php54's dependency)
brew tap homebrew/dupes
# install nginx + mysql + php 5.4 + php-fpm + apc + xdebug
brew install nginx mysql
@vargeorge
vargeorge / gist:3768187
Created September 22, 2012 23:19
FIX for Faraday::Error::ConnectionFailed SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
ISSUE:
Ran into this errors when adding Aumniauth with provider strategies such as Google to my rails app on Mac OS X development box. Clicking on 'Sign in with ...' (E.g. Sign in with Google), resulted in an error page:
Faraday::Error::ConnectionFailed
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
Faraday::Error::ConnectionFailed SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
DIAGNOSIS:
@lsiv568
lsiv568 / dropzone.coffee
Last active September 16, 2016 12:22
This directive uses the HTML5 drag and drop spec as well as the FileReader to base64 encode the dropped files. This allows for easy client/server transfer via REST protocol.
'use strict';
angular.module('reusableThings')
.directive('fileDropzone', () ->
restrict: 'A'
scope: {
file: '='
fileName: '='
}
link: (scope, element, attrs) ->
@samrocketman
samrocketman / ubuntu_1204_import_ca.md
Last active October 14, 2021 00:36
Adding certificate authorities to Ubuntu 12.04

Overview

If you're able to visit a website and it successfully validates but you're not able to curl the website (i.e. you get certificate validation errors) then it is likely because your root certificate, or intermediate certificate, or both are not trusted in your system. Ubuntu provides an easy process for updating the root certificate stores using the update-ca-certificates command and the /etc/ca-certificates.conf for configuration.

Add CA and Intermediates to Ubuntu

Certificates should be installed under /usr/share/ca-certificates. You should create a directory for your org to place all certs and intermediates.

mkdir /usr/share/ca-certificates/my.org/