Skip to content

Instantly share code, notes, and snippets.

@cristinecula
cristinecula / yelp_categories
Last active August 29, 2015 14:01
Yelp Categories as plaintext
Active Life (active)
ATV Rentals/Tours (atvrentals)
Amateur Sports Teams (amateursportsteams)
Amusement Parks (amusementparks)
Aquariums (aquariums)
Archery (archery)
Badminton (badminton)
Basketball Courts (basketballcourts)
Batting Cages (battingcages)
Beaches (beaches)
import {NgZone, Inject} from 'angular2/angular2';
export class TestService {
skin: any;
constructor(@Inject(NgZone) private zone: NgZone) {
this.skin = {color: 'red'};
}
getSkin() {
@cristinecula
cristinecula / controller.php
Created June 8, 2012 18:10
PayPal IPN Handler for CakePHP
<?php
App::uses('HttpSocket', 'Network/Http');
/* inside controller */
/**
* PayPal IPN Notification parser
* Checks if the notification is valid
* @see https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_admin_IPNIntro
* @see https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_IPNandPDTVariables
@cristinecula
cristinecula / normal-localhost.sh
Created July 11, 2012 08:55
Useful way to test localhost development on slow networks (Linux)
tc qdisc del dev lo root
@cristinecula
cristinecula / Document.php
Created October 12, 2012 11:27 — forked from beberlei/Document.php
My Symfony2 File Upload workflow
<?php
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\HttpFoundation\File\UploadedFile;
/**
* @Entity
*/
class Document
{
<script>
(function (window, document) {
var loader = function () {
var script = document.createElement("script"), tag = document.getElementsByTagName("script")[0];
script.type = 'text/javascript'; script.async = true;
script.src = "https://widgetic.com/sdk/sdk.js";
tag.parentNode.insertBefore(script, tag);
};
window.addEventListener ? window.addEventListener("load", loader, false) : window.attachEvent("onload", loader);
})(window, document);
tryTimes = (f, times, interval) ->
new Promise (resolve, reject) ->
tries = 0
doIt = ->
++tries
try
result = f()
if result
clear()
<form>
<label>
<input type="radio" bind:group='interval' name="interval" value="monthly">
<span>Monthly</span>
</label>
<label>
<input type="radio" bind:group='interval' name="interval" value="yearly">
<span>Yearly<span>Save 20%</span></span>
</label>
</form>
<!-- this binds `sy` to the current value of `window.scrollY` -->
<:Window bind:scrollY='sy' on:orientationchange='set({angle: event.orientation.angle})'/>
{{angle}}
<!-- try changing the values that `sy` is multiplied by -
values closer to 0 appear further away -->
<div class='parallax-container'>
<img style='transform: translate(0,{{-sy * 0.2}}px)' src='http://www.firewatchgame.com/images/parallax/parallax0.png'>
<img style='transform: translate(0,{{-sy * 0.3}}px)' src='http://www.firewatchgame.com/images/parallax/parallax1.png'>
<img style='transform: translate(0,{{-sy * 0.4}}px)' src='http://www.firewatchgame.com/images/parallax/parallax3.png'>
<img style='transform: translate(0,{{-sy * 0.5}}px)' src='http://www.firewatchgame.com/images/parallax/parallax5.png'>
@cristinecula
cristinecula / css-var-polyfill.js
Created May 13, 2017 06:54
CSS Variable Polyfill
/*
TODO:
- Option to wait to apply anything until all <link>s are parsed or inject what we have and update as each <link> returns
*/
var cssVarPoly = {
init: function() {
if (window.CSS && window.CSS.supports && window.CSS.supports('(--foo: red)')) {
return;
}
cssVarPoly.ratifiedVars = {};