Skip to content

Instantly share code, notes, and snippets.

View brunowego's full-sized avatar
🎯
Focusing

Bruno Wego brunowego

🎯
Focusing
View GitHub Profile
@bruceoutdoors
bruceoutdoors / DbmigrateController.php
Last active June 2, 2019 12:30
Laravel 4 Convert existing MySQL database to migrations. This is a fork of Christopher Pitt's work http://laravelsnippets.com/snippets/convert-an-existing-mysql-database-to-migrations, which is based off michaeljcalkins's work at http://paste.laravel.com/1jdw#sthash.0nEgQzQR.dpuf. His original source code doesn't really work out of the box in my…
<?php
/* * **
*
* This script converts an existing MySQL database to migrations in Laravel 4.
*
* 1. Place this file inside app/controllers/
*
* 2. In this file, edit the index() method to customize this script to your needs.
* - inside $migrate->ignore(), you pass in an array of table
@edouard-lopez
edouard-lopez / libsass-install.bash
Last active October 17, 2019 17:17
Installing/Compiling libsass and sassc on Ubuntu 14.04+/Linux Mint 17+ (needed by node-sass)
# Based on https://github.com/sass/libsass/wiki/Building-with-autotools
# Install dependencies
apt-get install automake libtool
# Fetch sources
git clone https://github.com/sass/libsass.git
git clone https://github.com/sass/sassc.git libsass/sassc
# Create configure script
@Kurt108
Kurt108 / analytics-admin.conf
Last active December 17, 2019 01:03
using keycloak-gatekeeper with matomo for single-sign on
server {
server_name analytics-admin-proxy.domain;
root /var/www/piwik;
access_log /var/log/nginx/access-piwik-admin.log combined;
error_log /var/log/nginx/error-piwik-admin.log;
index index.php;
listen 8081 default_server;
location / {
try_files $uri $uri/ /index.php$args;
}
@afranioce
afranioce / CpfCnpj.php
Last active August 14, 2020 11:17
Validador de cpf e cnpj para symfony2
<?php
namespace AppBundle\Validator\Constraints;
use Symfony\Component\Validator\Constraint;
/**
* @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
*
@igorpavlov-zz
igorpavlov-zz / gist:18af35999f8c7838cf21
Created February 22, 2015 00:24
AppRTC main JS code
var RTCPeerConnection = null;
var getUserMedia = null;
var attachMediaStream = null;
var reattachMediaStream = null;
var webrtcDetectedBrowser = null;
var webrtcDetectedVersion = null;
function trace(text) {
if (text[text.length - 1] === "\n") {
text = text.substring(0, text.length - 1);
@colllin
colllin / _affixWithinContainer.md
Last active November 29, 2020 17:13
ion-list sticky headers

What this does:

Within an <ion-scroll>, this directive creates sticky item headers that get bumped out of the way by the next item.

Demo: http://cl.ly/2u2X390s0H1a

Requirements:

  • Needs UnderscoreJS for its _.throttle utility.
  • Must be used within an or
@jamesarosen
jamesarosen / ember-xss.md
Created October 28, 2015 16:50
Ember and XSS Safety

TL;DR

In Ember, always use {{...}}, not {{{...}}}. Use Ember.String.htmlSafe as necessary in JavaScript (usually in a component) to mark markup as HTML-safe. Never pass user-entered content directly to Ember.String.htmlSafe.

Details

Ember has great XSS protection built in. The HTMLBars templating library will automatically run any interpolations through htmlEscape for you. So

@rkjha
rkjha / nginx-passenger-ssl.conf
Last active March 25, 2021 15:47
Nginx/Passenger config when using SSL with a Ruby/Rails Application.
# for redirecting hhtp traffic to https version of the site
server {
listen 80;
server_name example.com;
return 301 https://$server_name$request_uri;
}
# for redirecting to non-www version of the site
server {
listen 80;
@SheldonWangRJT
SheldonWangRJT / How-to-sort-a-List<Object>-in-JAVA?.md
Created July 20, 2018 15:40
How to sort a List<Object> in JAVA in the best way?

How to sort a List<Object> in JAVA in a better way / the best way?

This is some notes written by Sheldon. I mainly focused on iOS programming but I also do JAVA and C# backend, you can find me with #iOSBySheldon in Github, Youtube, Facebook, etc.

High order functions with lambda is very easy in Swift (see article Here) but not that easy in languages like Objective-C or C++. In JAVA we can do it but since JAVA has too many versions, there are a lot different ways to do it, and there is always a better one you can choose.

Assuming we have a class like:

class Student {
    private int age;
@lukecav
lukecav / Command
Last active May 27, 2021 00:27
DIsable K6 usage reports
K6_NO_USAGE_REPORT
export let options = {
noUsageReport: true
};