Skip to content

Instantly share code, notes, and snippets.

View CatinhoCR's full-sized avatar

Cato CatinhoCR

  • Costa Rica
  • 09:39 (UTC -06:00)
View GitHub Profile
@CatinhoCR
CatinhoCR / SomeCtrl.js
Created September 20, 2017 03:52 — forked from seyDoggy/SomeCtrl.js
My version of the AngularJS ui-bootstrap alert service as derived from here: https://coderwall.com/p/r_bvhg/angular-ui-bootstrap-alert-service-for-angular-js. No $rootScopes were harmed in the making of this code.
(function () {
'use strict';
angular.module('myApp')
.controller('SomeCtrl', SomeCtrl);
SomeCtrl.$inject = ['$scope', '$http', ' alertService'];
function SomeCtrl($scope, $http, alertService) {
$http.put('http://some.url/user/44', {
@mattes
mattes / wp-cli-install-with-brew.sh
Created October 18, 2013 13:45
Installing WP-CLI under Mac OS with Homebrew
#!/usr/bin/env
# curl https://gist.github.com/mattes/7041760/raw/wp-cli-install-with-brew.sh | bash
brew tap homebrew/dupes
brew tap josegonzalez/homebrew-php
brew install wp-cli
<?php
include('simple_html_dom.php');
$propuestasPopularesAsamblea = new propuestasPopularesAsamblea();
$propuestasPopularesAsamblea->index();
@kinnala
kinnala / gist:6376196
Created August 29, 2013 09:50
Soccerway API scraping example
import urllib2
import json
import re
class SoccerwayTeamMatches:
def __init__(self, teamId):
self.teamId = str(teamId)
self.data = {'all': [], 'home': [], 'away': []}
<?php
/**
* Kirki Sass Compiler
*
* Create a CSS file based on a SCSS-file and Kirki variables
* File gets saved in the public folder with a cache buster.
*/
namespace App\Kirki;
use ScssPhp\ScssPhp\Compiler;
@import "modular-scale";
@import "functions";
$base-font-size: 16px;
$base-line-height: 24px;
$rhythm-unit: "rem";
// Setup vertical rhythm
@include establish-baseline;
@thmsbkkr
thmsbkkr / in_viewport.js
Last active October 13, 2020 09:32 — forked from jjmu15/in_viewport.js
check if element is in viewport - vanilla JS. Use by adding a “scroll” event listener to the window and then calling isInViewport().
// Determine if an element is in the visible viewport
export default function isInViewport(element) {
var rect = element.getBoundingClientRect();
var html = document.documentElement;
return (
rect.top >= 0 &&
rect.left >= 0 &&
rect.bottom <= (window.innerHeight || html.clientHeight) &&
rect.right <= (window.innerWidth || html.clientWidth)
);
@thomseddon
thomseddon / gist:4703968
Last active October 21, 2020 08:50
Auto Expanding/Grow textarea directive for AngularJS
/**
* The MIT License (MIT)
*
* Copyright (c) 2013 Thom Seddon
* Copyright (c) 2010 Google
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@PurpleBooth
PurpleBooth / am-i-ready-to-open-source-this.md
Last active February 4, 2021 22:17
Checklist to see if your open source repo is primetime ready!

Am I ready to Open Source This?

The checklist:

  1. A readme following a good template
  2. A contributing.md with a code of conduct.
  3. A license
  4. Travis configuration
  5. A way for people to raise issues
  6. Link to it
@gaambo
gaambo / acf.js
Last active December 29, 2021 18:11
ACF Block with Innerblocks
import { Fragment } from "@wordpress/element";
import { InnerBlocks } from "@wordpress/editor";
/**
* Changes the edit function of an ACF-block to allow InnerBlocks
* Should be called like this on `editor.BlockEdit` hook:
* ` addFilter("editor.BlockEdit", "namespace/block", editWithInnerBlocks("acf/block-name"));`
*
* @param {string} blockName the name of the block to wrap
* @param {object} innerBlockParams params to be passed to the InnerBlocks component (like allowedChildren)