Skip to content

Instantly share code, notes, and snippets.

View jameswritescode's full-sized avatar
✍️
we vibing now

James Newton jameswritescode

✍️
we vibing now
View GitHub Profile
{
findSelector: function(selector, callback) {
return function(cssom) {
var rule = _.find(cssom.cssRules, { selectorText: selector });
callback(rule);
}
},
/*
spec/
  spec_helper.rb
  fake_ircd.rb
  protocols/
    charybdis_spec.rb
    ...
  services/
    nickserv/
 commands_spec.rb
<script>
var script = document.createElement('script');
script.src = "//example.com";
document.getElementsByTagName('head')[0].appendChild(script);
</script>
<script async src="//example.com"></script>
require 'centarra'
manager = Centarra::Manager.new
manager << Centarra::Account.new(name: 'carina', username: 'honk', key: 'honk')
manager << Centarra::Account.new(name: 'orion', username: 'honk', key: 'honk')
manager['carina'].vps_list
manager['carina'].signup 'huehue'
manager['orion'].dns # returns Centarra::DNS stuff, or whatever
describe 'imageDrop', ->
element =
$scope =
beforeEach inject ($rootScope, $compile) ->
$scope = $rootScope
element = angular.element('<image-drop></image-drop>')
$compile(element)($rootScope)
$scope.$digest()
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!-- Generated by: TmTheme-Editor -->
<!-- ============================================ -->
<!-- app: http://tmtheme-editor.herokuapp.com -->
<!-- code: https://github.com/aziz/tmTheme-Editor -->
<plist version="1.0">
<dict>
<key>gutterSettings</key>
<dict>

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

require 'cocaine'

Keybase proof

I hereby claim:

  • I am jameswritescode on github.
  • I am newton (https://keybase.io/newton) on keybase.
  • I have a public key whose fingerprint is D02D 3073 D8FA 7811 1860 1187 FB88 2A20 ED0C 12D2

To claim this, I am signing this object:

This is the third part of my [Learning code by comparison][1] series of learning C with explanations in Ruby.

It's always normal when writing a library, application, or other things in Ruby to use multiple files. It's common to do this with C too, but since we compile it's not as simple as our typical require.

To start off our Ruby example we'll create a Person module with common methods we'll want to include in our James class. This would allow us to give James extra methods that are unique to that class.

module Person
  def full_name
    "#{@first_name} #{@last_name}"