Skip to content

Instantly share code, notes, and snippets.

View Theminijohn's full-sized avatar
🤘
Building Growth Products

Mini John™ Theminijohn

🤘
Building Growth Products
View GitHub Profile
@Theminijohn
Theminijohn / .tmux.conf
Created August 27, 2015 10:58
Tmux Conf File
# Set prefix to Ctrl-Space
unbind C-b
set -g prefix C-Space
bind Space send-prefix
# Allows for faster key repetition
set -s escape-time 0
# Design
set -g status-left '#[fg=#a09f93,bg=#2d2d2d,bold] ༼ つ◕_◕ ༽つ #[fg=white,bg=#2d2d2d,nobold]#[fg=colour245,bg=#2d2d2d,bold] #(whoami) #[fg=colour238,bg=white,nobold]'
class Team < ActiveRecord::Base
# Friendly ID
extend FriendlyId
friendly_id :name
# Rolify
resourcify
# Associations
belongs_to :user
require 'perseus'
class TeamRankedStatJob < ActiveJob::Base
queue_as :default
def perform(team)
## Get ready
client = Perseus::Client.new(Settings.rito.api_key, region: team.server)
## Get Info
entries = client.league.entries_by_team(team.full_id).values.flatten
{"TEAM-c7aa72a0-9b21-11e4-85ae-782bcb48f791": [
{
"queue": "RANKED_TEAM_3x3",
"name": "Wukong's Lancers",
"entries": [{
"leaguePoints": 59,
"isFreshBlood": false,
"isHotStreak": false,
"division": "I",
"isInactive": false,
@Theminijohn
Theminijohn / player_champions.js.jsx
Created March 18, 2015 23:36
React.js from League I/O WIP
var PlayerChampions = React.createClass({
loadChampions: function() {
$.ajax({
url: '/api/v1/players/' + this.props.summoner + '/champions',
dataType: 'json',
success: function(data) {
this.setState({champions: data});
}.bind(this),
error: function(xhr, status, err) {
@Theminijohn
Theminijohn / observer.js
Created February 19, 2015 20:51
League of Legends Observer API
// http://codepen.io/brunorcunha/pen/KIBtn
function requisicao(acao, id, callback, erro)
{
var url = '';
if(acao == 'time') url = "retrieveInProgressSpectatorGameInfo/";
else if(acao == 'liga') url = "getLeagueForPlayer/";
else if(acao == 'stats') url = "retrievePlayerStatsByAccountId/";
else if(acao == 'nivel') url = "getSummonerByName/";
else if(acao == 'champs') url = "retrieveTopPlayedChampions/";
<div>
<input type="text" className="form-control ItemSearch" value={this.state.searchString} onChange={this.handleChange} placeholder="Search Items" />
<ul className="ItemSearchList">
{
items.slice(0,3).map(function(item){
return (
<li key={item.id} >
<div className="media">
<div className="media-left">
@Theminijohn
Theminijohn / regionals.json
Created July 7, 2014 10:03
Regional Country Codes
[
{
"name":"Afghanistan",
"alpha-2":"AF",
"alpha-3":"AFG",
"country-code":"004",
"iso_3166-2":"ISO 3166-2:AF",
"region-code":"142",
"sub-region-code":"034"
},
# 1st Example
raw_metas = file_content.scan( /\A\/\/\s==UserScript==(\w|\W)*\/\/\s==\/UserScript==$/ )
raw_metas.split(/\r\n|\n|\r/).each do |line_with_meta|
#each line is structured like @attribute<space>value
end
#so in this loop, we need another regex to get the attribute's name, and the value
# 2nd Example
raw_metas.split(/\r\n|\n|\r/).each do |line_with_meta|
attribute_name = line_with_data.scan(/@\w+/)
class Logic::JavascriptParser
def initialize(content)
@raw_content = content
JavascriptParser.new(params[:code_content])
end
def execute
self.parse
self.persist!