Skip to content

Instantly share code, notes, and snippets.

#include<stdio.h>
#include<math.h>
float f(float x){
return exp(x);
/*
return sqrt(1 - 0.162 * sin(x) * sin(x));
*/
}
#include<stdio.h>
#include<math.h>
float f(float x){
return (4*x-3*x*x);
/*
return (1/(1+x*x));
*/
}
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@synsh
synsh / monolog.php
Created August 7, 2017 13:07 — forked from mamchenkov/monolog.php
Example use of Monolog logger
<?php
// Before: composer require monolog/monolog
// composer autoloader
require_once 'vendor/autoload.php';
// Shortcuts for simpler usage
use \Monolog\Logger;
use \Monolog\Formatter\LineFormatter;
use \Monolog\Handler\StreamHandler;
<?php
/*==============================================================================
* Register the error handler
*/
$whoops = new \Whoops\Run;
if ($environment !== 'production') {
// show errors for cool kids
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
// log exception
<?php
$app->get('/exception', function ($req, $res, $args) {
// errorHandler will trap this Exception
throw new Exception("An error happened here");
});
$app->get('/php7', function ($req, $res, $args) {
$x = function (int $x) {
return $x;
};
@synsh
synsh / up-to-php7-in-cloud9.sh
Created August 7, 2017 19:22 — forked from shingorow/up-to-php7-in-cloud9.sh
On Cloud9, upgrade PHP 5 to 7.
# Install phpbrew
sudo apt-get update
sudo apt-get install libmcrypt-dev
curl -L -O https://github.com/phpbrew/phpbrew/raw/master/phpbrew
chmod +x phpbrew
sudo mv phpbrew /usr/local/bin/
phpbrew init
[[ -e ~/.phpbrew/bashrc ]] && source ~/.phpbrew/bashrc
@synsh
synsh / css-media-queries-cheat-sheet.css
Created October 2, 2017 17:22 — forked from bartholomej/css-media-queries-cheat-sheet.css
CSS Media Query Cheat Sheet (with Foundation)
/*------------------------------------------
Responsive Grid Media Queries - 1280, 1024, 768, 480
1280-1024 - desktop (default grid)
1024-768 - tablet landscape
768-480 - tablet
480-less - phone landscape & smaller
--------------------------------------------*/
@media all and (min-width: 1024px) and (max-width: 1280px) { }
@media all and (min-width: 768px) and (max-width: 1024px) { }
##################################################################
#!/bin/bash
# update the sources
sudo apt update
echo "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::updated apt repos"
sleep 2
# install zip & git
sudo apt -y install zip git
// Shows a dialog that allows the user to install the current instant app.
// https://developer.android.com/topic/instant-apps/reference.html#showinstallprompt
InstantApps.showInstallPrompt(this, new Intent(this, BaseActivity.class), 0, null);