Skip to content

Instantly share code, notes, and snippets.

// ==========================================================================
// Project: CamUi - mainPage
// Copyright: ©2010 My Company, Inc.
// ==========================================================================
/*globals CamUi */
ControlPanelView = SC.StackedView.extend({
childViews: 'axialCmdButtons axisSelectionLabel axisSelectionRadio momementModeLabel movementModeRadio feedrateLabel feedrateSlider'.w(),
useStaticLayout: YES,
const int N_OF_COILS = 3;
struct BrushlessDCMotor
{
int hal_pins[N_OF_COILS];
//positive and negative coil pins
int pos_coil_pins[N_OF_COILS];
int neg_coil_pins[N_OF_COILS];
// The current value of each hal sensor and coil output
// include the library code:
#include <LiquidCrystal.h>
int ammeter_pin = 0;
int amps_per_volt = 1; //amps per volt measured on the ammeter pin
int voltmeter_pin = 1;
int volts_per_volt = 1; //volts per volt measured on the voltmeter pin
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
#! /usr/bin/env python
'''
Copyright (C) 2007 Aaron Spike (aaron @ ekips.org)
Copyright (C) 2007 Tavmjong Bah (tavmjong @ free.fr)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
// Mouse Picking (transforming mouse coordinates to world coordinates)
if ((op = this.mouse.ops["movement"]).enabled == true)
{
// Scaling the mouse position to -1 < x,y < 1 eye coordinates (z=near/far)
var eye_coord = []
for (var i=0; i<2; i++)
{
var scale = 2/size[i];
eye_coord[i] = (xy[i] - op.init_mouse_position[i])*scale
}
@D1plo1d
D1plo1d / rebaseerrors
Created January 8, 2011 23:26
big-rebase errors
{
[javac] ^
[javac] /home/rob/Documents/replicators/replicatorg-5d/src/replicatorg/drivers/DriverBaseImplementation.java:255: cannot find symbol
[javac] symbol : class Point5d
[javac] location: class replicatorg.drivers.DriverBaseImplementation
[javac] protected Point5d reconcilePosition() {
[javac] ^
[javac] /home/rob/Documents/replicators/replicatorg-5d/src/replicatorg/drivers/DriverBaseImplementation.java:259: cannot find symbol
[javac] symbol : class Point5d
[javac] location: class replicatorg.drivers.DriverBaseImplementation
<div id="relative-nav">
<? $bottom_links = $page->prev_next(); ?>
<? if ($bottom_links[0]) { ?><a href="<? echo $bottom_links[0] ?>">&lt; <span>Previous</span></a><? }; ?>
<? if ($bottom_links[1]) { ?><a href="<? echo $bottom_links[1] ?>"><span>Next</span> &gt;</a><? }; ?>
</div>
@D1plo1d
D1plo1d / asuser.rb
Created August 15, 2012 03:03 — forked from bmc/asuser.rb
Run block as another user, in subprocess
require 'etc'
def as_user(user, &block)
# Find the user in the password database.
u = (user.is_a? Integer) ? Etc.getpwuid(user) : Etc.getpwnam(user)
# Fork the child process. Process.fork will run a given block of code
# in the child process.
Process.fork do
# We're in the child. Set the process's user ID.
fs = require 'fs-extra'
{print} = require 'util'
which = require 'which'
{spawn, exec} = require 'child_process'
assets = require 'connect-assets'
buildAssets = (options = {}, callback) ->
cleanAssets options, ->
_buildAssetsAfterCleaning options, callback
@D1plo1d
D1plo1d / has_secure_password_patch.rb
Last active December 15, 2015 09:49
Rails 3.2 has_secure_password patch. Backported from Rails 4 to remove the "Password_digest can't be blank" validation message and replace it with the more human readable "Password can't be blank" message. To patch your has_secure_password method add this file to your app's config/initializers directory
module ActiveModel
module SecurePassword
module ClassMethods
# Stolen from rails 4
def has_secure_password(options = {})
# Load bcrypt-ruby only when has_secure_password is used.
# This is to avoid ActiveModel (and by extension the entire framework)
# being dependent on a binary library.
begin
gem 'bcrypt-ruby', '~> 3.0.0'