Skip to content

Instantly share code, notes, and snippets.

View freekrai's full-sized avatar

Roger Stringer freekrai

View GitHub Profile
@freekrai
freekrai / header.html
Created February 20, 2015 19:54
Data McFly header
<!--
88888888o. .
888 888 .o8 .ooooooo. oooo oooo oooo
888 888 888888o. .o888oo 888880. ooo. .oo. .oo. .o88888o. 888 `888 `888 888'
888 888 888 888 888 `888P"Y88bP"Y88b 888 888oooo 888 `888888'
888 888 .o8888888 888 .o8888888 888 888 888 888 888 888 `888'
888 888 888 888 888 . 888 888 888 888 888 888 888 888 88' .o.
888888888' `Y8bod8P' "888" `Y8bod8P' o888o o888o o888o `Y8bod8P' o888o o888o 88' Y8P
@freekrai
freekrai / practice
Last active August 29, 2015 14:16 — forked from dbalatero/practice
#!/usr/bin/env ruby
class Practice
def initialize
@data = {}
try_to_load_data
end
def record_today(minutes)
@data[key_for(Time.now)] = minutes
@freekrai
freekrai / sparklines.js
Created May 7, 2015 15:58
sparklines.js
var data, ticks;
ticks = ['▁', '▂', '▃', '▄', '▅', '▆', '▇', '█'];
exports.clark = function(data) {
var m, n, t;
m = Math.min.apply(Math, data);
n = (Math.max.apply(Math, data) - m) / (ticks.length - 1);
return ((function() {
var i, len, results;
@freekrai
freekrai / curl.md
Last active August 29, 2015 14:21 — forked from btoone/curl.md

Introduction

An introduction to curl using GitHub's API

The Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin
@freekrai
freekrai / export.php
Created May 15, 2015 14:22
wordpress to camel
<?php
/*
Place this file inside a folder called /export/ and run it from there as http://yoursite/export/export.php
*/
include "../wp/wp-load.php";
include "../wp/wp-admin/includes/file.php";
define('DB_NAME', 'DNNAME');
@freekrai
freekrai / swap.md
Created June 25, 2015 14:46
dokku swap file
  1. If /extraswap was previously created then run:
sudo swapoff /extraswap && sudo rm /extraswap    
  1. Type:
dd if=/dev/zero of=/extraswap bs=1M count=1024
// # getScript()
// more or less stolen from jquery core and adapted by paul irish
function getScript(url,success) {
var head = document.getElementsByTagName("head")[0], done = false;
var script = document.createElement("script");
script.src = url;
// Attach handlers for all browsers
script.onload = script.onreadystatechange = function(){
if (!done && (!this.readyState || this.readyState === "loaded" || this.readyState === "complete") ) {
@freekrai
freekrai / article.md
Last active August 29, 2015 14:25
Startup Landing Pages with Flybase

Now-a-days Landing Page has become common and popular among startups and publishers. Every landing page has one important call-to-action, i.e. to sign up early adopters for their beta version.

To get up & running as soon as possible, the simplest and fastest way to build a landing page is basically having it as a static site without any back end. The downside of this approach is, we need to figure out a way to store the emails that are signed up. As you would expect, there are quite a few really good services you can use right of the bat.

@freekrai
freekrai / chat.js
Last active August 29, 2015 14:25
delete convo from sms contact
var chatManager = function(datamcflyRef) {
this.datamcflyRef = datamcflyRef;
};
chatManager.prototype = {
chats: [], // collection of chats in progress
getChat: function(fromNumber) {
// finds or creates a chat from a particular recipient
var foundChat = null;
@freekrai
freekrai / article.md
Last active August 29, 2015 14:27
ngHello.js

This days I’ve been playing with hello.js. Hello is a A client-side Javascript SDK for authenticating with OAuth2 web services.

It’s pretty straightforward to use and well explained at documentation. I want to use it within AngularJS projects. OK, I can include the library and use the global variable “hello”, but it isn’t cool.

Imagine one simple AngularJS application

(function () {
    angular.module('G', [])
        .config(function ($stateProvider, $urlRouterProvider) {