Skip to content

Instantly share code, notes, and snippets.

View peterdemartini's full-sized avatar
😎
being awesome

Peter DeMartini peterdemartini

😎
being awesome
View GitHub Profile
@peterdemartini
peterdemartini / new_gist_file.php
Created March 4, 2014 18:44
SugarCRM Custom JSON API Entry Point
<?php
class CustomAPI {
var $inbound = false;
public function __construct(){
$this->inbound = $this->parse_inbound_json();
}
public function get_inbound(){ return $this->inbound; }
@peterdemartini
peterdemartini / new_gist_file.php
Created March 13, 2014 16:19
SugarCRM Duplicate Bean
<?php
function duplicate_bean($bean){
$exclude = array(
'id',
'date_entered',
'date_modified'
);
$newbean = new $bean->object_name;
foreach($bean->field_defs as $def){
@peterdemartini
peterdemartini / follow_twitter_users.js
Last active August 29, 2015 14:03
Unfollow and Follow Twitter Users. Simply load a page of twitter followers and type this into the console.
$('.user-actions-follow-button').filter(function(){ return $(this).find('.follow-text:visible').size(); }).sort(function() {
return .5 - Math.random();
}).slice(0, 1000).click();
@peterdemartini
peterdemartini / gist:cbf96a5d647fb47cb215
Created November 19, 2014 05:05
Sublime Vintage Mode Cheatsheet ( Not finished )

Sublime Vintage Mode Cheatsheet

Movements

Key(s) Command(s)
h, j, k, l left, up, down, right
0, ^, $ beginning, first character, end of line
f, F go to next occurrence of character on current line
gg, G, : go to first line, last line, line number
node_modules/.bin/browserify -t coffeeify --extension=".coffee" -s GatebluWebsocket index.coffee > public/gateblu-websocket.js && hs -p 3444
mkdir -p ~/tmp/devices
cd ~/tmp/devices
npm init -y
npm install meshblu-blink1
cd meshblu-blink1
echo '{
"uuid": "370b01b5-1927-44a1-a30b-2147430a4fae",
"token": "561bbf70d2aa2db62d22d8f85c19155c52184995",
"server": "meshblu.octoblu.com",
"port": 443
npm install meshblu-util -g
mkdir -p ~/tmp/devices
cd ~/tmp/devices
npm init -y
npm install meshblu-blink1
cd meshblu-blink1
meshblu-util register -t 'device:blink1' > meshblu.json
echo "YAY!!! Device created manually run 'npm start'"
docker run \
--name gateblu-forever \
-e DEBUG=gateblu-forever* \
-e MESHBLU_SERVER=meshblu.octoblu.com \
-e MESHBLU_PORT=3000 \
-e MESHBLU_UUID=c6366d66-7bb8-438d-908e-5cc724aa5c0e \
-e MESHBLU_TOKEN=f7d0d2c3850045e986b2a34a94142c34
octoblu/gateblu-forever:latest
tmux set -g status-right '#(powerline tmux right)'
var meshblu = new Meshblu(config);
console.log('starting...');
meshblu.connect(function(response){
var update = {
"optionsSchema":{
"type":"object",
"properties":{
"allowRemoteStart":{
"type":"boolean",