Skip to content

Instantly share code, notes, and snippets.

View armandocanals's full-sized avatar
👾
0_0

Armando Canals armandocanals

👾
0_0
View GitHub Profile
@armandocanals
armandocanals / slideRuler.m
Last active August 29, 2015 13:59
Slide Ruler UIView
UIScrollView* timer = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 120, 700, 60)];
timer.backgroundColor = [UIColor whiteColor];
timer.delegate = self;
timer.scrollEnabled = YES;
timer.contentSize = CGSizeMake(_createView.frame.size.width+700, 60);
[self addTopBorder:timer];
for (int i = 55; i > 0; i--) {
UIView *tine = [[UIView alloc] initWithFrame:CGRectMake((i*12), 1, 1, 7)];
- (void) drawCountdownSpinner {
int radius = 70;
CAShapeLayer *circle = [CAShapeLayer layer];
circle.path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, 2.0*radius, 2.0*radius)
cornerRadius:radius].CGPath;
circle.position = CGPointMake(CGRectGetMidX(self.view.frame)-radius,
CGRectGetMidY(self.view.frame)-radius-40);
@armandocanals
armandocanals / micro-template.js
Last active August 29, 2015 14:02
Micro-templates based off underscore templates
template = function(text, data, translation) {
var matches = text.match(/\{\{([\s\S]+?)\}\}/g);
if (matches === null) { return text; }
if (translation !== undefined) {
for(key in translation) {
data[key] = translation[key];
}
}

Keybase proof

I hereby claim:

  • I am armandocanals on github.
  • I am armandocanals (https://keybase.io/armandocanals) on keybase.
  • I have a public key whose fingerprint is 285E E34A BF34 BB60 2B00 1577 BA60 4B0F 9E14 ADC5

To claim this, I am signing this object:

#!/usr/bin/env ruby
require 'rubygems'
require 'json'
root = File.expand_path(ARGV[0] ? ARGV[0] : ".") + "/"
objectName = "JST"
templateDir = "templates/"
templates = Dir["#{root}#{templateDir}**/*.jst"]
contents = {}

GPG

Overview

packagecloud:enterprise uses GPG keys to sign repository metadata. You can let packagecloud:enterprise generate a GPG key itself during install or you can import an existing GPG key.

Read more about GPG, RPM packages, and yum repos.

@armandocanals
armandocanals / gist:939961
Created April 24, 2011 23:06
SMS Blast using Twilio
require 'rubygems'
require 'open-uri'
require 'csv'
require 'rest_client'
csv = open("path/to/file.csv") # I choose csv, you can choose whatever file you want to loop through
arr = []
CSV.parse(csv) do |row|
cell_num = row[2] #row for cell number
home_num = row[3] #row for home_num
@armandocanals
armandocanals / retina_detect
Created March 20, 2012 02:07
Detect retina asset in DOM using javascript
function retina(selector) {
var element = document.querySelector(selector);
var images = Array.prototype.slice.apply(element.getElementsByTagName("img"));
var extension = "_2x";
if (window.devicePixelRatio === 2) {
images.forEach(function(img, idx) {
var src = img.getAttribute('src');
img.setAttribute('src', src.replace(/(\.jpg|\.png|\.gif)$/, extension + '$&'));
img.onerror = function(evt) {
img.setAttribute('src', src);
class Node
attr_accessor :next, :data
def push(str)
new_node= Node.new
new_node.data = str
node = self
while node.next