Skip to content

Instantly share code, notes, and snippets.

@Sigmus
Sigmus / heredoc.php
Last active August 29, 2015 14:05
heredoc.php
<?php
$trocar = 'tentar';
$conteudo = <<<DEMO
Isto é um teste. Vamos $trocar dados.
DEMO;
<?php
class Destaque extends Aware {
const STATUS_PUBLISHED = 1;
const STATUS_UNPUBLISHED = 0;
public static $rules = array(
@Sigmus
Sigmus / beautiful.js
Created December 17, 2014 02:25
A Beautiful Function
var handleCheckAlternative = function(result) {
var playSound = playWrongAudio;
var after = renderInfos;
if (isLastQuestion(result)) {
after = _.compose(renderPoints, quizOver);
}
if (result.correct && isLastQuestion(result)) {
playSound = playTouchdown;
}
else if (result.correct) {
<?php
$filter_r=216;
$filter_g=0;
$filter_b=26;
$suffixe="_red";
$path=YOURPATHFILE;
if(is_file($path)){
$image=@imagecreatefromjpeg($path);
$new_path=substr($path,0,strlen($path)-4).$suffixe.".png";
{"date":{"$date":"2015-02-04T00:00:00.744+0000"},"ask_price":1.14568,"bid_price":1.14564,"ask_volume":1,"bid_volume":5.21000003814697}
{"date":{"$date":"2015-02-04T00:00:01.200+0000"},"ask_price":1.1457,"bid_price":1.14566,"ask_volume":2.25,"bid_volume":1}
{"date":{"$date":"2015-02-04T00:00:02.618+0000"},"ask_price":1.1457,"bid_price":1.14567,"ask_volume":1,"bid_volume":1}
{"date":{"$date":"2015-02-04T00:00:03.124+0000"},"ask_price":1.1457,"bid_price":1.14566,"ask_volume":1,"bid_volume":1}
{"date":{"$date":"2015-02-04T00:00:06.447+0000"},"ask_price":1.1457,"bid_price":1.14566,"ask_volume":1,"bid_volume":2.25}
{"date":{"$date":"2015-02-04T00:00:06.962+0000"},"ask_price":1.14571,"bid_price":1.14568,"ask_volume":1.5,"bid_volume":1.5
@Sigmus
Sigmus / focus-first-ref.js
Last active August 29, 2015 14:21
React mixin to focus element with ref="firstInput"
const React = require('react');
module.exports = {
componentDidMount() {
this.focusFirstInput();
},
focusFirstInput() {
const input = this.refs.firstInput; // <input ref="firstInput" />
{
"caret_style": "phase",
"color_scheme": "Packages/Dayle Rees Color Schemes/sublime/contrast/earthsong-contrast.tmTheme",
"create_window_at_startup": false,
"font_face": "Inconsolata",
"font_size": 17.0,
"highlight_line": true,
"highlight_modified_tabs": true,
"ignored_packages":
[

layout: post title: Next circular array item

A function that returns the next item in a given array. Starts over when the last item is reached.

var next = nextCircularItem(['x', 'y', 'z']);
@Sigmus
Sigmus / country.js
Created August 31, 2015 21:55
Country Name
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<style>
html, body {
height: 100%;
margin: 0;
padding: 0;
// clica em cor, motor ou opcional
// altera objeto dude e manda
// gerar urls de todas as imagens
// de novo
var dude = {
color: 296,
version: 'longitude',
engine: 100,
opcionais: [
{code: '430', selected: true},