Skip to content

Instantly share code, notes, and snippets.

View rondorkerin's full-sized avatar

null_x3r0 rondorkerin

View GitHub Profile
@rondorkerin
rondorkerin / gist:6137044
Created August 2, 2013 02:20
Minimax algorithm
q-=q<e;l-=l<=e; /* adj. window: delay bonus */
d=Y=0; /* start iter. from scratch */
X=myrand()&~M; /* start at random field */
W(d++<n||d<3|| /*** min depth = 2 iterative deepening loop */
z==8&K==I&&(N<T&d<98|| /* root: deepen upto time */
(K=X,L=Y&S-9,d=3))) /* time's up: go do best */
{x=B=X; /* start scan at prev. best */
h=Y&S; /* request try noncastl. 1st*/
P=d>2&&l+I?minimax(24-k,-l,1-l,-e,S,S,d-3):I; /* search null move */
m=-P<l|R>35?d-2?-I:e:-P; /*** prune if > beta unconsidered:static eval */
<?php
class Payment
{
private $provider;
private $test_mode;
public static $allowedProviders = array('authorize', 'paymenttest');
const FREE_PLAN = 1;
const BASIC_MONTHLY_PLAN = 2;
@rondorkerin
rondorkerin / gist:6691024
Created September 24, 2013 20:49
Hilarity
foreach ($mappings as $mapping) {
$companyLeadFieldID = $mapping['companyLeadFieldID'];
$companyLeadField = $this->companyleadfields_model->getByID($companyID, $companyLeadFieldID);
foreach($_POST as $key => $value) {
if ($mapping['postField'] == $key) {
$fieldName = $companyLeadField['fieldName'];
@rondorkerin
rondorkerin / HTML Code
Created February 15, 2014 00:34
HTML code for a library website
<html>
<head>
<title>My webpage!</title>
</head>
<body>
<h1>Welcome to the library</h1>
<p>Here's a list of books in our library!</p>
<ul>
<li>The Art of Zen - Alan Watts</li>
<li>The Jungle Book - That one guy</li>
@rondorkerin
rondorkerin / gist:9377821
Last active August 29, 2015 13:57
A Backbone.js view
var GoalView = (function(){
var my = {};
my.GoalCategory = Backbone.View.extend({
render: function(category) {
var data = this.model;
data['goals'] = this.collection.filter(function(model) {
return model.attributes['category'] == data.category;
});
var template = _.template($('#goalCategoryTpl').text(), data);
@rondorkerin
rondorkerin / gist:9377867
Created March 5, 2014 22:21
A Reddit Bot
require 'snoo'
require 'json'
require 'open-uri'
task :reddit do
@cfg = Rails.application.config
@after = nil
puts @cfg.minutes_between_posts.to_s + " minutes between posts... initializing @ #{Time.new()}"
replies = {}
@rondorkerin
rondorkerin / gist:9377922
Created March 5, 2014 22:23
A Backbone.js Router
$(function() {
var goals = new GoalCollection([]);
console.log(goals.url);
var goalCategoryView = null;
var Router = Backbone.Router.extend({
routes: {
":category": "category",
},
@rondorkerin
rondorkerin / gist:11354093
Last active August 29, 2015 14:00
TODO list:
Go through the entirety of vimtutor (http://linuxcommand.org/man_pages/vimtutor1.html)
Learn how to use tmux (http://robots.thoughtbot.com/a-tmux-crash-course)
Learn how to install LAMP on ubuntu (php version 5.3 apache 2.2)
Get an older version of ubuntu (12.04 or earlier) http://releases.ubuntu.com/12.04/
Read http://www.phptherightway.com/
Go through this linux guide: http://tldp.org/LDP/intro-linux/html/
Read about supervisor (we use it to control all of our daemons) http://supervisord.org/
Read about gearman (this is how we make backend queues) http://gearman.org/
<!DOCTYPE html> <html><head>
<style> .main { font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 11pt; } .signature { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; color: #5e5e5e; font-size: 10pt; } .tagline { color: #d4421a; } .recent { color: #198fd7 } .link { text-decoration: underline; }
</style>
</head>
<body><img src="http://www.messagegears.net/o/1/23295228/m15414-6237e9f7-b483-4abf-8eec-1f8ecd077edd/ntbafnyirf/terngwnxrf/pbz" width="1" height="1" />
<div class="”editable" main="" .content”="" data-editable="”standard”"><p><span style="font-size: 12pt; font-family: arial, helvetica, sans-serif;">Hi&nbsp;Andrew,</span></p>
<p><span style="font-family: arial, helvetica, sans-serif; font-size: 12pt;">First of all, thanks for your interest in Great Jakes. I'd love to give you a call to discuss what we can do for you. Just send me your phone number and the best time to reach you. If possible, let me know a little bit about what you're looking for so I can be prepared with all the
@rondorkerin
rondorkerin / gist:bfbbc7c6fd5e99b14a9d
Created June 5, 2014 20:22
Example Request and Response for SharpSpring APIv1
"Request Data:"
{
"method":"getLead",
"params":{
"id":"<a lead id>"
},
"id":"<your request ID>",
}