This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
OUTSIDE_STATE = true | |
NAMES = {:objects => []} | |
module CheckSelf | |
module ClassMethods | |
def self.inherited(child) | |
::NAMES[:objects] << child | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts "#{ENV['RUBY_VERSION']}" | |
require 'rubygems' | |
require 'httparty' | |
require 'forwardable' | |
module Rulers | |
module Model | |
module HttpModel |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('cardUiApp') | |
.directive('card', function () { | |
return { | |
template: ' content', | |
restrict: 'AE', | |
scope: { | |
name: '@', | |
amount: '=', | |
save: '&' | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Usage: | |
// <show-code url='https://gist.github.com/your-user-name/XXXXX.js'></show-code> | |
angular.module('yourAppName') | |
.directive('showCode', function () { | |
return { | |
restrict: 'E', | |
transclude: true, | |
scope: { | |
url: '@url' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/Users/orionengleton/.rvm/rubies/ruby-2.1.1/bin/ruby | |
log = [ | |
{time: 201201, x: 2},{time: 201201, y: 7},{time: 201201, z: 2}, | |
{time: 201202, a: 3},{time: 201202, b: 4},{time: 201202, c: 0} | |
] | |
# Required - Results. | |
required_result = [{:time=>201201, :x=>2, :y=>7, :z=>2}, {:time=>201202, :a=>3, :b=>4, :c=>0}] | |
# Using global variables * and #Procs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Eratta Elixir In Action Chpt. 6 Listing 6.x pg. 170 | |
defmodule ServerProcess do | |
def start(callback_mod) do | |
spawn(fn -> | |
initial_state = callback_mod.init | |
loop(callback_mod, initial_state) | |
end) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#-- Follow this great writeup for prerequisites- having erlang/elixir/gitinstalled. | |
#-- Setting up repos on the vps etc. | |
#-- http://gabrieljaldon.com/articles/deploying-phoenix-with-git.html | |
# In my case - I'M NOT USING PHOENIX I had to modified the post-receive hook in the repo | |
#-------- post-receive hook | |
#!/bin/bash | |
git --work-tree=/<your>/<path>/<toyour.app> --git-dir=/<your>/<path>/<toyour.REPO> checkout -f; | |
cd /<your>/<path>/<toyour.app> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Specifically written for - this problem with folders unzipped from this https://www.prepbootstrap.com website. | |
# may be able to help someone solve similar issue. | |
# | |
# Problem: Folder contains no folder structure - but hints at them in the file names: | |
# / | |
# Theme-LightWayAdmin\blog.html | |
# Theme-LightWayAdmin\font-awesome\less\list.less | |
# Theme-LightWayAdmin\bootstrap-elements.html | |
# Theme-LightWayAdmin\font-awesome\less\mixins.less |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ecto - Model | |
defmodule YourPhoenixApp.PaperclipAvatar do | |
use YourPhoenixApp.Web, :model | |
alias YourPhoenixApp.{Repo, PaperclipAvatar} | |
# | |
# There are places in my existing app where only the avatar image is required. | |
# So I created a module that sole purpose was to read that data. | |
# | |
schema "users" do | |
field :avatar_file_name, :string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Citrusbyte do | |
@moduledoc """ | |
This module - demonstrates use of pattern matching in Elixir to modify a list. | |
[[1,2,[3]],4] -> [1,2,3,4] | |
Usage: | |
Citrusbyte.example [[1,2,[3]],4] #=> [1,2,3,4] | |
""" |
OlderNewer