Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View josejaguirre's full-sized avatar
🤺
Programming

José Aguirre josejaguirre

🤺
Programming
View GitHub Profile
@josejaguirre
josejaguirre / README.md
Created September 27, 2017 18:55 — forked from jonathantneal/README.md
SASS @font-face mixin

Font Face

A mixin for writing @font-face rules in SASS.

Usage

Create a font face rule. Embedded OpenType, WOFF2, WOFF, TrueType, and SVG files are automatically sourced.

@include font-face(Samplino, fonts/Samplino);
@gbabiars
gbabiars / Scores.js
Created December 20, 2015 21:15
Basic example of RxJS and React
import React from 'react';
import axios from 'axios';
import Rx from 'rxjs';
export default class App extends React.Component {
constructor(props) {
super(props);
this.state = {
scores: []
};
@codeopensrc
codeopensrc / RealmWrapper.md
Last active April 15, 2019 02:13
A javascript wrapper for the RealmDB node module used in React Native.

My RealmWrapper.js file. Uses RealmSchema.js for the schema.

You can find the "realmSchema.js" here and examples here

'use strict';

import Realm from 'realm';
import Schemas from "./realmSchemas.js";
const version = 51;
@sofa420
sofa420 / fabfile.py
Created July 30, 2012 17:55 — forked from kmpm/fabfile.py
Fabric deployment of Node.js on Ubuntu
from __future__ import with_statement
from fabric.api import env
from fabric.api import *
from fabric.contrib.console import confirm
from fabric.contrib.project import upload_project
import ubuntu
import protobuf
@HoundstoothSTL
HoundstoothSTL / wp-download.sh
Created November 15, 2012 20:10
Download Wordpress through terminal and cleanup
#!/bin/bash
#Download the latest copy of WordPress into a directory, grab all the files in the new /wordpress folder
#Put all the files in the current directory, remove the now empty /wordpress directory
#Remove the tarball
#download latest wordpress with wget
wget http://wordpress.org/latest.tar.gz
#OR using CURL
@cam-gists
cam-gists / fgc.php
Created July 2, 2012 19:47
PHP: file_get_contents vs. cURL
<?php
$html = file_get_contents("http://example.com/product/42");
$context = stream_context_create(array(
"http" => array(
"method" => "POST",
"header" => "Content-Type: multipart/form-data; boundary=--foo\r\n",
"content" => "--foo\r\n"
. "Content-Disposition: form-data; name=\"myFile\"; filename=\"image.jpg\"\r\n"
. "Content-Type: image/jpeg\r\n\r\n"
@qiao
qiao / ip.js
Created January 17, 2012 11:27
Node.js get client IP address
// snippet taken from http://catapulty.tumblr.com/post/8303749793/heroku-and-node-js-how-to-get-the-client-ip-address
function getClientIp(req) {
var ipAddress;
// The request may be forwarded from local web server.
var forwardedIpsStr = req.header('x-forwarded-for');
if (forwardedIpsStr) {
// 'x-forwarded-for' header may return multiple IP addresses in
// the format: "client IP, proxy 1 IP, proxy 2 IP" so take the
// the first one
var forwardedIps = forwardedIpsStr.split(',');
@dmdavis
dmdavis / utc_to_local.py
Created March 20, 2014 18:31
Example of converting UTC to local time using python-dateutil
#!/usr/bin/env python
# encoding: utf-8
"""
utc_to_local.py
Example of converting UTC to local time using python-dateutil.
https://pypi.python.org/pypi/python-dateutil
"""
from datetime import datetime
@setola
setola / functions.php
Last active September 25, 2020 18:29 — forked from johnmegahan/functions.php
Extended Walker class for use with the Twitter Bootstrap toolkit Dropdown n-levels menus in Wordpress.
<?php
/**
* Extended Walker class for use with the
* Twitter Bootstrap toolkit Dropdown menus in Wordpress.
* Edited to support n-levels submenu.
* @author johnmegahan https://gist.github.com/1597994, Emanuele 'Tex' Tessore https://gist.github.com/3765640
* @license CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
*/
class BootstrapNavMenuWalker extends Walker_Nav_Menu {
@mrob11
mrob11 / models.py
Last active October 27, 2020 11:22
Simple follower/following relationship in Django
$ ./manage.py shell
Python 2.7.5 (default, Aug 25 2013, 00:04:04)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from followers.models import *
>>> john = User.objects.create_user('john', 'lennon@thebeatles.com', 'password')
>>> paul = User.objects.create_user('paul', 'mccartney@thebeatles.com', 'password')
>>> george = User.objects.create_user('george', 'harrison@thebeatles.com', 'password')
>>> ringo = User.objects.create_user('ringo', 'starr@thebeatles.com', 'password')